troubleshooting Question

ASP not reading SQL data into array...?

Avatar of techleet
techleet asked on
28 Comments1 Solution1699 ViewsLast Modified:

Big problem.  If I run a sql query straight from the mysql prompt on the server, I get 2 rows and 3 colums of data.  Here's the query and results:

SELECT name_first, name_last, email FROM registered_users WHERE user_type = 1

Bob    Jones
Jane   Doe

Now, if I do the same thing in ASP (VBscript) and try to access the second row, ( like myArray(0,1) )  I get a "Object doesn't support this property or method" error... it looks like ASP IS NOT READING THIS INTO A 2-dimensional ARRAY...?  myArray(0) works fine, myArray(0,1) gets the error.

I'm a newbie @ ASP/VBscript, so perhaps I'm missing something very easy.  I program in many languages though, so it's not rocket science!

Here's my ASP code:

Set db = Server.CreateObject("ADODB.Connection")
db.Open "Driver={MySQL ODBC 3.51 Driver}; Server=localhost; Port=3306; Option=0; Socket=; Stmt=; Database=server; Uid=useraccount; Pwd=password;"
adminRS = db.execute("SELECT name_first, name_last, email from registered_users where user_type = 1")

Dim iRowLoop, adminRows
adminRows = adminRS.getrows()

For iRowLoop = 0 to UBound(adminRS, 2)
      response.write("<option value='" & adminRows(iRowLoop,2) & "'>" & adminRows(iRowLoop,0) & adminRows(iRowLoop,1) & "</option>")

Microsoft VBScript runtime (0x800A01B6)
Object doesn't support this property or method: 'getrows'

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 28 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 28 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros