Forum Moderators: open
I have about 50 fields in each record in a SQL table. I am building an ASP page with a form to update the values in the fields. I have done this a bazillion times the old fashioned way, pulling each field by name. Today I tried a shortcut. Code below.
For Each x In objRS.Fields
response.write x.Name & " - " & x & "<br>"
Next
Sure enough, the above code writes all 50 fieldnames and their values to screen. (x.Name is the field name, and x is the value)
Slick. But... I think I need to be able to assign a variable to a variable... so that the x.Name (which is the field name) becomes a variable, with x as the value. I can't seem to do that!
In the above example, let's say the first iteration through the loop produces
x.Name="FirstName"
x="Joe"
What I need to do is end up with a variable
FirstName = "Joe"
So later in the page, I can write out the variable FirstName and display the value "Joe"... and hopefully do the same for the other 49 fields in the database.
Any hints? Any clues? Is this impossible? lol
Thanks in advance for the help - even if it's not possible, at least knowing for sure will put me out of my misery!
JD
Although the ASP gathers only required data, it's possible that internally fields could be added and/or inserted by someone else and I figured an array would maybe need more ongoing maintenence.
Thanks again to all for feedback and help!
JD