|
 |
asp_databases thread: Is one DB connection per session enough?
Message #1 by "Nick Drew" <nick6@b...> on Thu, 27 Apr 2000 12:16:58
|
|
Hi,
I have a site which is happily making connections to a SQL Server7
database, but I don't really understand the relationship between Connection
Objects and Recordset Objects well enough to answer the following query.
Once a connection has been made in the ASP page, I use this object to set
the new Recordset's .ActiveConnection property before opening the Recordset
as follows:
Set oConn = Server.CreateObject("ADODB.Connection")
Set oRS = Server.CreateObject("ADODB.Recordset")
oRS.ActiveConnection = oConn
sMySQL = "SELECT * FROM ......"
oRS.Open sMySQL, , , , adCmdText
If I wanted to open two recordets simultaneously (i.e. oRS and oRS2), can
they make use of the same Connection Object, or must I create a second
Connection (i.e. oConn2) Object to handle the second Recordset?
Your help would be gratefully appreciated.
Regards,
Nick
Message #2 by =?iso-8859-1?Q?=C1rni_B=2E_Halld=F3rsson?= <abh@t...> on Thu, 27 Apr 2000 11:31:43 -0000
|
|
you can use multiple recordsets per one data connection, but I
recommend you
try other ways, like using join if possible.
Regards
Arni B. Halldorsson
abh@t...
-----Original Message-----
From: Nick Drew
Sent: 27. apr=EDl 2000 12:17
To: ASP Databases
Subject: [asp_databases] Is one DB connection per session enough?
Hi,
I have a site which is happily making connections to a SQL Server7
database, but I don't really understand the relationship between
Connection
Objects and Recordset Objects well enough to answer the following
query.
Once a connection has been made in the ASP page, I use this object to
set
the new Recordset's .ActiveConnection property before opening the
Recordset
as follows:
Set oConn =3D Server.CreateObject("ADODB.Connection")
Set oRS =3D Server.CreateObject("ADODB.Recordset")
oRS.ActiveConnection =3D oConn
sMySQL =3D "SELECT * FROM ......"
oRS.Open sMySQL, , , , adCmdText
If I wanted to open two recordets simultaneously (i.e. oRS and oRS2),
can
they make use of the same Connection Object, or must I create a second
Connection (i.e. oConn2) Object to handle the second Recordset?
Your help would be gratefully appreciated.
Regards,
Nick
---
You are currently subscribed to asp_databases
$subst('Email.Unsub')
Message #3 by romita_roy@y... on Fri, 28 Apr 2000 8:12:46
|
|
Hi Nick,
No u don't need to open another connection object to open two recordsets
simultaneously. One connection object is enough for ur requirements.
The only thing u have to do is set:
oRs.ActiveConnection = oConn
and
oRs2.ActiveConnection = oConn
before u open the respective recordsets.
Cheers,
Romita.
---------------------------------------
Hi,
I have a site which is happily making connections to a SQL Server7
database, but I don't really understand the relationship between
Connection
Objects and Recordset Objects well enough to answer the following query.
Once a connection has been made in the ASP page, I use this object to set
the new Recordset's .ActiveConnection property before opening the
Recordset
as follows:
Set oConn = Server.CreateObject("ADODB.Connection")
Set oRS = Server.CreateObject("ADODB.Recordset")
oRS.ActiveConnection = oConn
sMySQL = "SELECT * FROM ......"
oRS.Open sMySQL, , , , adCmdText
If I wanted to open two recordets simultaneously (i.e. oRS and oRS2), can
they make use of the same Connection Object, or must I create a second
Connection (i.e. oConn2) Object to handle the second Recordset?
Your help would be gratefully appreciated.
Regards,
Nick
|
|
 |