Link to home
Start Free TrialLog in
Avatar of dave doyle
dave doyle

asked on

convert array into single variable string classic asp

I have a looping  array that outputs all necessary data from table . I need to take that looped array and output it in a single string that I can use later in some other code .

Set Products_cmd = Server.CreateObject ("ADODB.Command")
Products_cmd.ActiveConnection = dbHistory
Products_cmd.CommandText = "SELECT * FROM organic WHERE isActive=0" 
Products_cmd.Prepared = true

Set Products = Products_cmd.Execute

Dim arrProducts
arrProducts = Products.GetRows()

dim i
For i = 0 to ubound(arrProducts, 2)
   response.write( trim(arrProducts(1,i))+"," )
next

myNewVar_organic=???

Open in new window


Thanks in advance
ASKER CERTIFIED SOLUTION
Avatar of Big Monty
Big Monty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The idea of using getrows allows you to use your arrProducts  variable throughout the page without ever having to go back to the database. Depending on what you are trying to do, you may be fine not taking the arrProducts and putting it to another variable.
Avatar of dave doyle
dave doyle

ASKER

Perfect, many thanks!