Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Database connection sharing

Reply
Thread Tools

Database connection sharing

 
 
Atif Jalal
Guest
Posts: n/a
 
      08-08-2003
How can I share the sane databse connection between asp.net pages. I
also use objects(middleware), so can I pass the same DB connection
when I instantiate the object by calling its constructor?
 
Reply With Quote
 
 
 
 
Steve C. Orr, MCSD
Guest
Posts: n/a
 
      08-08-2003
This connection sharing is done automatically. ADO.NET has built in
connection pooling.
Open your db connection just before you need it, and close it as soon as you
are done with it.
As long as you use the same exact connection string everywhere the sharing
will be automatic - you will not actually open a new database connection
each time despite what the syntax suggests. The connections will be
recycled for you.
Purposely keeping connections open and trying to pass them to other pages
will result in inefficient, poorly performing code.

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net


"Atif Jalal" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> How can I share the sane databse connection between asp.net pages. I
> also use objects(middleware), so can I pass the same DB connection
> when I instantiate the object by calling its constructor?



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Database Database Database scott93727@gmail.com Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase scott93727@gmail.com Computer Information 0 09-26-2012 09:40 AM
Sharing a DBI::Mysql database connection with your children Andrew DeFaria Perl Misc 7 04-01-2008 11:01 PM
Sharing database connection with controls Mike P2 ASP .Net 4 06-03-2007 02:29 PM
Sharing database connection from C to Python dgiagio@gmail.com Python 1 02-01-2006 09:16 PM



Advertisments