VBScript: ARRAY from a record set... ASP code
Build an array from a Record set
(NOTE that the first part of a record set array is the table columns
and the second part is the row!!)
| <% DIM rs, i
DIM rsARR
DIM rsCOL_1, rsCOL_2, rsCOL_3, rsCOL_4
Set rs = Server.CreateObject("ADODB.Recordset")
rs.connectionstring = YOURDATABASECONNECTIONSTRING
rs.Open
IF NOT rs.eof then
rsARR = rs.GetRows()
FOR i = 0 to ubound(rsARR, 2)
rsCOL_1 = rsARR(0, i)
rsCOL_2 = rsARR(1, i)
rsCOL_3 = rsARR(2, i)
rsCOL_4 = rsARR(3, i)
' you code goes
here-----------------------------
' you code goes
here-----------------------------
NEXT
ELSE
response.write ("NO Records found!")
END IF
rs.close
set rs = nothing
%> |
|