Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Building array with GetString result

Status
Not open for further replies.

jwoughter

Programmer
Jul 19, 2009
2
US
I have a query that, at this moment, only returns 2 records. Also, I'm only returning 1 column from the records as that is all I need.

I use rs.GetString to return the results in a nice list.

I want to pull, out of that list, 1 item at a time.

Ultimately, I want to be able to get a list of records that meet the query requirements, put them in an array, and randomly select one of the records to display on the web.

Does anyone know a way I could accomplish this?
 
because i didn't know about that. lol

using that method, would i be able to do a myarray(0) or myarray(1) to get the record i want out of the list?
 
It actually adds it into a 2-dimensional array

Read about it here


if you want a single dimensional array, you can do something like this:

Code:
dim myArray()
set myRS = myConn.execute(mySQL)
	myRS.movefirst
	i = 1
	do while not myRS.eof
		redim preserve myArray(i)
		myArray(i) = rs("myField")
		i = i + 1
		if not myRS.eof then myRS.movenext
	loop
	myRS.close
set myRS = nothing

--------
GOOGLE is a great resource to find answers to questions like "how do i..."

If you don't know exaclty what you want to do or what to search on, try Google Suggest: --------
I have recently been semi-converted to ensuring all my code (well most of it) works in both javascript and non-javasc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top