|
BeTheBall -> RE: option explicit and getrows (3/26/2005 11:56:50)
|
Yes, you will get an error if you don't declare the array. As far as "initializing" the array, I am not positive what you mean by that. Generally, you use a For/Next Loop to gather the data from the array. Here is a simply example that displays one field from a table in a one-column, multi-rowed table: <%option explicit%>
<html>
<head>
<title>Test</title>
<meta name="Microsoft Border" content="tlrb, default">
</head>
<body>
<%
Dim conntemp, myDSN, myRS, mySQL, arrTable, nRows, row, col
Set conntemp=Server.CreateObject("ADODB.Connection")
myDSN ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("fpdb/Review304.mdb")
conntemp.open myDSN
mySQL = "SELECT IDRS, [Name] FROM Employees"
Set myRS = Server.CreateObject("ADODB.Recordset")
myRS.Open mySQL, conntemp, 0, 1
arrTable=myRS.GetRows()
myRS.Close
Set myRS = nothing
conntemp.Close
Set conntemp = nothing
%>
<TABLE BORDER=1>
<%
nRows = UBound(arrTable, 2 )
For row = 0 To nRows
%>
<TR>
<%
For col = 0 To UBound(arrTable, 1 )
%>
<TD><%=arrTable(col, row)%> </TD>
<% Next %>
</TR>
<% Next %>
</TABLE>
<p> </body>
</html>
|
|
|
|