-
August 19th, 2013, 09:41 PM
#106
Re: VB Script will not remove modified data from Database
Originally Posted by DataMiser
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
-
August 22nd, 2013, 04:42 PM
#107
Re: VB Script will not remove modified data from Database
-
August 22nd, 2013, 11:23 PM
#108
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.
-
August 23rd, 2013, 09:13 AM
#109
Re: VB Script will not remove modified data from Database
Originally Posted by DataMiser
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..
-
August 23rd, 2013, 06:48 PM
#110
Re: VB Script will not remove modified data from Database
Originally Posted by davida1956
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
%>
-
August 23rd, 2013, 07:17 PM
#111
Re: VB Script will not remove modified data from Database
Originally Posted by davida1956
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
-
August 26th, 2013, 11:17 AM
#112
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.
-
August 26th, 2013, 11:26 AM
#113
Re: [RESOLVED] VB Script will not remove modified data from Database
Originally Posted by DataMiser
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 :-)
-
August 28th, 2013, 09:31 PM
#114
Re: [RESOLVED] VB Script will not remove modified data from Database
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|