Article ID: 191572
Article Last Modified on 6/29/2007
|Recordset |Recordset |Command |Command
|created |created |created |created
|with |with |with |with
|Server. |CreateObject |Server. |CreateObject
|CreateObject | |CreateObject |
-----------------------------------------------------------------------
Explicit |1.Yes |1.Yes |1.Yes |1.Yes
Connection |2.Conn.Close |2.Conn.Close |2.Conn.Close |2.Conn.Close
created with | | | |
Server. | | | |
CreateObject | | | |
-----------------------------------------------------------------------
Explicit |1.Yes |1.Yes |1.Yes |1.Yes
Connection |2.Conn.Close |2.Conn.Close |2.Conn.Close |2.Conn.Close
created with | | | |
CreateObject | | |
---------------------------------------------------------------------------
Implicit |1.No |1.Yes |1.No |1.No
Connection |2.N/A |2.Set |2.N/A |2.N/A
| | Recordset | |
| | = Nothing | |
---------------------------------------------------------------------------
Explicit Connection - Server.CreateObject
sConnect="DRIVER={SQL Server};SERVER=ServerName;DATABASE=Pubs;UID=<username>;PWD=<strong password>"
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open sConnect
Explicit Connection - CreateObject
sConnect="DRIVER={SQL Server};SERVER=ServerName;DATABASE=Pubs;UID=<username>;PWD=<strong password>"
Set Conn = CreateObject("ADODB.Connection")
Conn.Open sConnect
Implicit Connection with Recordset
sConnect="DRIVER={SQL Server};SERVER=ServerName;DATABASE=Pubs;UID=<username>;PWD=<strong password>"
Set Rs = CreateObject("ADODB.Recordset")
Rs.Open "SELECT * FROM Authors", sConnect
Sample ASP page:
<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<BODY>
>%
dim cn(10)
dim cmd(10)
For x = 0 to 10
Set cn(x) = Server.CreateObject("ADODB.Connection")
cn(x).Open "DRIVER={SQL Server};SERVER=Ovteam;DATABASE=Pubs;UID=<username>;PWD=<strong password>"
Set cmd(x) = Server.CreateObject("ADODB.Command")
cmd(x).activeconnection = cn(x)
cmd(x).commandtext = "SELECT * FROM Authors"
cmd(x).execute
Response.Write "Command executed: " & x & "<BR>"
Set cmd(x) = Nothing
cn(x).close 'comment this line out to recreate the problem
Set cn(x) = Nothing
Next
%>
</BODY>
<HTML>
169470 INF: Frequently Asked Questions About ODBC Connection Pooling
176056 INFO: ADO/ASP Scalability FAQ
Keywords: kbdatabase kbinfo KB191572