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 >
Wrap
Text File
|
1996-10-07
|
984b
|
33 lines
<HTML>
<HEAD><TITLE>ActiveX Data Objects</TITLE></HEAD>
<BODY>
<H3>ActiveX Data Objects</H3><P>
Reusing a connection across pages with Session state<P>
<% If IsObject(Session("SessionConnection")) Then
Set Connection = Session("SessionConnection") %>
<FONT COLOR="Green">Using the Cached Session connection</FONT><P>
<% Else
Set Connection = Server.CreateObject("ADODB.Connection")
Set Session("SessionConnection") = Connection
Connection.Open "ADOSamples" %>
<FONT COLOR="Yellow">Opening the Connection</FONT><P>
<% End If %>
<% SQL = "SELECT ProductName, ProductDescription FROM Products WHERE ProductType in ('Boot', 'Tent')"
Set RS = Connection.Execute(SQL)
%>
Here are the results from the query:<BR><I><B> <%= SQL %></I></B><P>
<TABLE BORDER>
<% Do While Not RS.EOF %>
<TR>
<TD><%= RS("ProductName") %></TD><TD><%= RS("ProductDescription") %></TD>
</TR>
<% RS.MoveNext
Loop
RS.Close
%>
</TABLE>
</HTML>