PDA

View Full Version : Can a Javascript Array be created from an ASP recordset?


hilmesb
03-28-2003, 06:55 PM
I have created an ASP recordset with the following code:

set rs = db.execute("Select value1 value2 from tablename")

now I have a recordset named RS containing value1 and value2.

From this I can put the values in a two dimensional array variable thusly:

avarTable = RS.getrows()

Is there a way to reference "avarTable" in a javascript function? Will the array be the same?

arnyinc
03-28-2003, 07:46 PM
Maybe I'm just not being clever enough, but I'm pretty sure you you will have to create a javascript function that reads each of the elements of your ASP array into a javascript array.

When all is said and done, all ASP does is create text which can be plugged into javascript or HTML anyway you want.

edit: Here's a link that might be helpful. http://aspfree.com/authors/anandv/vb2jsarray.asp

JohnKrutsch
03-28-2003, 10:12 PM
JavaScript can't read the ASP but you can use the ASP to loop through and dynamically write out a two demensional array in javascript. Then yes, your javascript array will be identical to your ASP array.

hilmesb
03-31-2003, 02:21 PM
Thanks for all the help. I will keep in mind all the suggestions and attempt to make them fit.