home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 March / VPR9703A.ISO / MS_DEV / VID / SERVER / ASF / DATA.Z / ado4.asp < prev    next >
Text File  |  1996-10-07  |  764b  |  35 lines

  1. <HTML>
  2. <H1>ActiveX Data Objects</H1> 
  3. <H2>Simple Example Retrieving all results into an array</H2>
  4. <%
  5.   Set Conn = Server.CreateObject("ADODB.Connection")
  6.   Conn.Open "ADOSamples"
  7.   sql="SELECT * FROM Orders"
  8.   Set RS = Conn.Execute(sql)
  9. %>
  10. Here are the results from the query:<BR><i><b>  <%=sql%></i></b><P>
  11. <P>
  12. <TABLE BORDER=1>
  13. <TR>
  14.   <% For i = 0 to RS.Fields.Count - 1 %>
  15.      <TD><B><%= RS(i).Name %></B></TD>
  16.   <% Next %>
  17. </TR>
  18. <%
  19.   ' Put up to 100 rows in a 2d variant array
  20.   v=RS.GetRows(100) 
  21.   RS.close
  22.   Conn.close
  23. %>
  24.  
  25. <P>
  26. <%for row = 0 to UBound(v,2)  ' iterate through the rows in the variant array%>
  27. <TR>
  28.     <%for col = 0 to UBound(v,1)%>  
  29.     <TD>       <%=v(col,row)%> </TD>
  30.     <%next%>
  31. </TR>
  32. <%next%>
  33. </TABLE>
  34. </HTML>
  35.