CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 8 of 8 FirstFirst ... 5678
Results 106 to 114 of 114
  1. #106
    Join Date
    Jun 2013
    Posts
    102

    Re: VB Script will not remove modified data from Database

    Quote Originally Posted by DataMiser View Post
    You never showed where you tried the select statement so I do not know where you went wrong.

    If you have the hex value of the newly changed color that you want to display the name for and that hex value exists in the same record of the same table with the colorname as seems to be the case then as I have said a few times now it is just 1 simple select statement

    Code:
    SQLString="Select ColorName from LinkColor Where ColorCode='" & TheHexString &"'"
    You then execute that to create the RS and if the RS returns a result it will be the colorname you are looking for.

    I do not know if I am using the correct field names here as you keep bouncing around on naming conventions but ColorName would be the field that holds the literal text value Green for example and colorcode would be the field that has the HexString in it and both in the same table so whatever they are called that is what you would use. TheHexString would be the variable that holds the actual hexstring you are looking up to match the colorname to.

    If you try the select and it don;t work show what you tried rather than just saying you tried it as clearly if you tried it the right way it would work and there is no way to know what mistakes you make without knowing what you are doing and please forget about the other stuff. You should not be talkign about any other script or table as all that does it confuses the issue and makes it very hard to follow what you are talking about.

    Hi DM..... Thanks for that.. I will play with it and see if I can make it work... if not I'll keep careful notes of what is going on so you can see.... banging head now so will crack on in the morning :-) Reards. ..DA

  2. #107
    Join Date
    Jun 2013
    Posts
    102

    Re: VB Script will not remove modified data from Database

    Quote Originally Posted by davida1956 View Post
    Hi DM..... Thanks for that.. I will play with it and see if I can make it work... if not I'll keep careful notes of what is going on so you can see.... banging head now so will crack on in the morning :-) Reards. ..DA
    Hi DM.... had to take a few days out Sorry but I just don't understand you..... or the construct of the string. I don't know what "" or "'" does so cant transpose it to the TYPE becaue I need to detect one thing from 1 table before I can do a lookup in the other table.

    SQLString="Select ColorName from LinkColor Where ColorCode='" & TheHexString &"'"

    SQLString ="Select TypeName from Type where TypeColour='''....??? & thehexstring that is dragged out of LinkColor ???


    the two values are not in the same table. LinkColor gives you the literal text and the hex value. TYPE Gives you the TypeName, lets call it HOLIDAY and it fetches the colour you want FROM LinkColor, it's cross referenced some how so is beyond me right now as I just cant see how a DB query works, pretty fed up with my effort so far. so don't know what to do but will keep trying..... Regards...DA

  3. #108
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: VB Script will not remove modified data from Database

    You said that you were already able to display the hex string. That means that you have it and you know what it is. You can use that to get the color name just like I showed you. What is so hard to understand about that and why do you keep insisting on talking about other tables?

    This is an example of what I am saying about it being very hard to follow you. First you say

    the two values are not in the same table.
    but then you immediately say
    LinkColor gives you the literal text and the hex value.
    I count 2 values there, the hex value and the literal text. You already had the hex value and you want the literal text so you use the hex value to get it, understand?

    What you do up to that point is not the question as you said that was already working,

    Anyway I am going to leave this alone we seem to be going around in circles and the subject is pretty far off the original thread question.
    Always use [code][/code] tags when posting code.

  4. #109
    Join Date
    Jun 2013
    Posts
    102

    Re: VB Script will not remove modified data from Database

    Quote Originally Posted by DataMiser View Post
    You said that you were already able to display the hex string. That means that you have it and you know what it is. You can use that to get the color name just like I showed you. What is so hard to understand about that and why do you keep insisting on talking about other tables?

    This is an example of what I am saying about it being very hard to follow you. First you say



    but then you immediately say

    I count 2 values there, the hex value and the literal text. You already had the hex value and you want the literal text so you use the hex value to get it, understand?

    What you do up to that point is not the question as you said that was already working,

    Anyway I am going to leave this alone we seem to be going around in circles and the subject is pretty far off the original thread question.

    Hi DM.... I am sorry about all of this, it really has 'done my head in' as we say here. I haven't been able to display the correct hex value. The closest I ever got was to display the hex value of the color that it used to be and not what it had become when I changed it, yet changing the name and displaying the new value did work. Can I make a fresh start with a new thread or call it a day ? I would be happy to mark this as completed if you wish because in doing this exercise I have corrected another problem that I hadn't noticed which really only came to light with your help? I must admit you have been great and patient beyond belief. When our colleges open here after the summer break I am going to see if there are any evening classes that I could attend that may help me in the future..

  5. #110
    Join Date
    Jun 2013
    Posts
    102

    Re: VB Script will not remove modified data from Database

    Quote Originally Posted by davida1956 View Post
    Hi DM.... I am sorry about all of this, it really has 'done my head in' as we say here. I haven't been able to display the correct hex value. The closest I ever got was to display the hex value of the color that it used to be and not what it had become when I changed it, yet changing the name and displaying the new value did work. Can I make a fresh start with a new thread or call it a day ? I would be happy to mark this as completed if you wish because in doing this exercise I have corrected another problem that I hadn't noticed which really only came to light with your help? I must admit you have been great and patient beyond belief. When our colleges open here after the summer break I am going to see if there are any evening classes that I could attend that may help me in the future..
    Hi DM..... this bit of code almost works and displays the correct NewName and it shows the correct 'hexcode' text for the changed colour. All I need to do now is compare the text in one field with the value in the other field... is there an easy way to do this please?
    Code:
    <%
    ' If the form has been submitted (Flag = True), and the Category Name field isn't empty, update the record.
    Else
    
    Dim TypeRS
    Dim NewName
    Dim NewColor
    	Query = "SELECT * FROM Type WHERE TypeId=" & Request("TypeId")
    	Set TypeRS = Server.CreateObject("ADODB.Recordset")
    	TypeRS.Open Query, Connect, 2, 3
    	TypeRS("TypeName") = Request("TypeName")
    	TypeRS("TypeColor") = Request("LinkColor")
    	Session("NewName")=TypeRS("TypeName")
    	Session("NewColor")=Request("LinkColor")
    	TypeRS.Update
    	TypeRS.Close()
    	Response.Redirect("category_change.asp")
    End If
    						%>

  6. #111
    Join Date
    Jun 2013
    Posts
    102

    Re: VB Script will not remove modified data from Database

    Quote Originally Posted by davida1956 View Post
    Hi DM..... this bit of code almost works and displays the correct NewName and it shows the correct 'hexcode' text for the changed colour. All I need to do now is compare the text in one field with the value in the other field... is there an easy way to do this please?
    Code:
    <%
    ' If the form has been submitted (Flag = True), and the Category Name field isn't empty, update the record.
    Else
    
    Dim TypeRS
    Dim NewName
    Dim NewColor
    	Query = "SELECT * FROM Type WHERE TypeId=" & Request("TypeId")
    	Set TypeRS = Server.CreateObject("ADODB.Recordset")
    	TypeRS.Open Query, Connect, 2, 3
    	TypeRS("TypeName") = Request("TypeName")
    	TypeRS("TypeColor") = Request("LinkColor")
    	Session("NewName")=TypeRS("TypeName")
    	Session("NewColor")=Request("LinkColor")
    	TypeRS.Update
    	TypeRS.Close()
    	Response.Redirect("category_change.asp")
    End If
    						%>
    SOLVED !!!!!... The answer was so simple that I never thought of it till now...... I modified the Database duplicating the information so that ColorCode and ColorName both contained the same value and it worked a treat....Boy is that a relief... I thought it would drive me crazy but I'm a happy lad now. It may not be the ultimate solution but it does what I need it to do and that's what counts I guess

  7. #112
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: [RESOLVED] VB Script will not remove modified data from Database

    Well glad you got it working but either you were giving me bogus info in a lot of those posts or what I showed you 50 posts back would have worked like a charm without changing the database at all.
    Then again looking over some of the posts it is very easy to get lost in trying to figure out what you have, your posts are very confusing at times.
    Always use [code][/code] tags when posting code.

  8. #113
    Join Date
    Jun 2013
    Posts
    102

    Re: [RESOLVED] VB Script will not remove modified data from Database

    Quote Originally Posted by DataMiser View Post
    Well glad you got it working but either you were giving me bogus info in a lot of those posts or what I showed you 50 posts back would have worked like a charm without changing the database at all.
    Then again looking over some of the posts it is very easy to get lost in trying to figure out what you have, your posts are very confusing at times.
    Hi DM .... thanks for replying. I think my problem is that I don't understand the code well enough to try and explain what I want to do. It is really confusing code and difficult to understand at times and rather than take a little chunk at a time I was trying to look at the larger picture which is not the correct way to do things. I'm sure that the way you showed me what to do was the best way to do things so will go backwards and try to understand what you have been trying to teach me before I move onto the last problem I have. I can't yet handle more than 1 thread at a time :-) Again though thanks so much for your help and patience :-)

  9. #114
    Join Date
    Jun 2013
    Posts
    102

    Re: [RESOLVED] VB Script will not remove modified data from Database

    Quote Originally Posted by davida1956 View Post
    Hi DM .... thanks for replying. I think my problem is that I don't understand the code well enough to try and explain what I want to do. It is really confusing code and difficult to understand at times and rather than take a little chunk at a time I was trying to look at the larger picture which is not the correct way to do things. I'm sure that the way you showed me what to do was the best way to do things so will go backwards and try to understand what you have been trying to teach me before I move onto the last problem I have. I can't yet handle more than 1 thread at a time :-) Again though thanks so much for your help and patience :-)

    Hi DM I backtracked your replies and implemented the changes you suggested. I may be a little wiser on the second pass than I was on the first, not quite sure how I did it but it works just as you said it would. I've returned the DB back to its original format. I did discover a fundamental flaw in the script whilst doing the updates that are linked to the colour selection but I guess that is another story. There is only one change left that I would like to tackle but for some reason I don't seem to be able to post a new thread. Is there a procedure I need to follow that I am perhaps unaware of or... by now forgotten all about ??

Page 8 of 8 FirstFirst ... 5678

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured