Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

Don't use implicit connections when opening a Recordset

Total Hit ( 5303)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


As most ADO developers know well, there are basically two distinct syntax for opening a Connection and then a Recordset: you can explicitly create and open a Connection object, and then pass it to the 2nd argument of the Recordset's Open method (or assign to the Recordset's ActiveConnection property, which has the same effect). Or you can create an implicit connection object by passing a connection string to the 2nd argument of the Recordset's Open method.

In regular Visual Basic programs, the two techniques are equivalent, but when you work under ASP the story is different, and it's more complex. In fact, when you create a Recordset object using Server.CreateObject and then open it - thus creating an implicit Connection object - that connection isn't automatically returned to the Connection pool when the Recordset is closed (or when the page completes its execution). Instead, the connection is returned to the pool only when it times out, usually after one minute. Needless to say, this can be an obstacle that can prevent your site from scaling correctly, and should be avoided by creating a Connection object explicitly.

Notice that you don't have this problem if you instantiate the Recordset using the CreateObject function, instead of the Server.CreateObject method.


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.