vex
14 years agoContributor
MySQL Results from ADODB object
I'm writing some routines for my scripts that allow it to interface with our product MySQL database. I've got this fully functional in respects of the connection and all that, but dealing with query results is the difficult part.
For example, if I have code that does a SQL query "select * from users where userid = 1" I get results like the following:
How can I go about seperating each of these, and more importantly, how can I better distinguish field names in the results? I could do a "show columns from users" and then get each of those in an array and use RecSet.Fields for each column, but that starts getting excessive for the amount of code necessary.
Is there an easier way to work with database data?
#### Edit ####
Actually, I think I just figured out a better way to do this. Nevermind :)
For example, if I have code that does a SQL query "select * from users where userid = 1" I get results like the following:
1 -397798563169603749647922069782069523 auser@emailaddress.com 1/11/2011 1:16:34 PM 2/11/2012 1:16:42 PM KA5512 active 1 3/15/2012 4:00:00 AM env_stg 1
How can I go about seperating each of these, and more importantly, how can I better distinguish field names in the results? I could do a "show columns from users" and then get each of those in an array and use RecSet.Fields for each column, but that starts getting excessive for the amount of code necessary.
Is there an easier way to work with database data?
#### Edit ####
Actually, I think I just figured out a better way to do this. Nevermind :)
While Not RecSet.EOF
For Each f in RecSet.Fields
Log.Message f.Name & " -- " & f.Value
Next
WEnd