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

  1. <HTML>
  2. <HEAD><TITLE>ActiveX Data Objects</TITLE></HEAD>
  3. <BODY>
  4. <H3>ActiveX Data Objects</H3><P>
  5. Reusing a connection across pages with Session state<P>
  6.  
  7. <% If IsObject(Session("SessionConnection")) Then
  8.      Set Connection = Session("SessionConnection") %>
  9.      <FONT COLOR="Green">Using the Cached Session connection</FONT><P>
  10. <% Else
  11.      Set Connection = Server.CreateObject("ADODB.Connection")
  12.      Set Session("SessionConnection") = Connection
  13.      Connection.Open "ADOSamples" %>
  14.      <FONT COLOR="Yellow">Opening the Connection</FONT><P>
  15. <% End If %>
  16.  
  17. <% SQL = "SELECT ProductName, ProductDescription FROM Products WHERE ProductType in ('Boot', 'Tent')"
  18.    Set RS = Connection.Execute(SQL)
  19. %>
  20.  
  21. Here are the results from the query:<BR><I><B>  <%= SQL %></I></B><P>
  22. <TABLE BORDER>
  23. <% Do While Not RS.EOF %>
  24. <TR>
  25. <TD><%= RS("ProductName") %></TD><TD><%= RS("ProductDescription") %></TD>
  26. </TR>
  27. <% RS.MoveNext
  28.    Loop
  29.    RS.Close
  30. %>
  31.  
  32. </TABLE>
  33. </HTML>