View Full Version : Populating a 2-D array from a database

08-20-2002, 10:31 AM
Hello all, me again.

I have realised I need a 2-D instead of the 1-D array (below) for ther est of task to work.
My question is how can I change the code below to make it a 2-D array.


<script language = "JavaScript">
<!-- //Begin Hide
//Create the Array

var messages=new Array(<%=rsCount("MaxCount")%>);

//Populate the Array
i = 0
do while NOT rsBroadcast.EOF
messages[<%=i%>]="<font color=orange><%=rsBroadcast("Title")%></font>"
i = i + 1
// End Hide -->


the other 'column' in the array is going to be the "message" column from the same table as the title of that helps.



PS. this forum is fantastic for responses, I can't believe how everyone responds so quickly!

08-20-2002, 12:51 PM
maybe a stupid question, buth why are you trying to populate an array with data from a recordset (which is itself an array)

in your title, i read populating ... from a database so i assume you could use a select-query to generate a recordset that contains those two variables ? no ?

08-20-2002, 02:06 PM
Use the .GetRows() method (http://www.devguru.com/Technologies/ado/quickref/recordset_getrows.html) . It will automatically put your rs into a 2d array.