Friday, December 14, 2007

How to transfer the table (in a recordset) into the array?

How to transfer the table (in a recordset) into the array?


We can transfer the table (in a recordset) into the array.

The ASP codes are written and described as below:



<%

Set conn = Server.CreateObject("Adodb.Connection")

conn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("db1.mdb")

Set rs = Server.CreateObject("Adodb.Recordset")

rs.open "Member",conn,1,3 'Open a Recordset that can perform batch processing

MyArray = rs.getrows

rs.Close

Set rs = Nothing

response.write(MyArray(1,2))

'The first number identify the column(field) in the table and the second identify each record in that column.

%>

No comments: