|
-
Aug 7th, 2005, 10:02 PM
#1
[RESOLVED] Query on Connection object in ADO.Net
In VB6.0 I used to open just one public Connection object and use it in all my recordsets, is it still advisable to employ such strategy in ADO.Net?
Last edited by dee-u; Aug 7th, 2005 at 10:16 PM.
-
Aug 7th, 2005, 10:09 PM
#2
Sleep mode
Re: Query on Connection object in ADO.Net
Con obj creation is a resource consuming .Although , conn objs that have the same conn strings are pooled but they consume resources the moment they're created.
-
Aug 7th, 2005, 10:11 PM
#3
Re: Query on Connection object in ADO.Net
It seems that didnt clarify things on my original query? Should I use one public Connection object in ADO.Net or create it as it is needed? Or it will depend upon the database I am interacting with if it is Access or SQL Server?
-
Aug 7th, 2005, 10:12 PM
#4
Re: Query on Connection object in ADO.Net
Using a single database connection is a good idea in my opinion. You would not leave it open when not in use, however.
-
Aug 7th, 2005, 10:14 PM
#5
Re: Query on Connection object in ADO.Net
 Originally Posted by jmcilhinney
You would not leave it open when not in use, however.
Hmmmnnn... Then I should close and open it as it is needed?
-
Aug 7th, 2005, 10:16 PM
#6
Sleep mode
Re: Query on Connection object in ADO.Net
Use 1 glolabl connection obj , close it when you're done . Add this to my previous post !
-
Aug 7th, 2005, 10:24 PM
#7
Re: Query on Connection object in ADO.Net
Same question thrown at jmcilhinney, should I close and open it as it is needed? In VB6.0 I used to make it stay opened... What would be the issues if I'll leave it open?
-
Aug 7th, 2005, 10:28 PM
#8
Re: Query on Connection object in ADO.Net
Like everything, you should reduce the access to a connection to only what you need. Also, you are tying up a resource while the connection is open.
-
Aug 7th, 2005, 10:29 PM
#9
Re: Query on Connection object in ADO.Net
 Originally Posted by jmcilhinney
Like everything, you should reduce the access to a connection to only what you need.
I cant seem to understand it, could you elaborate on it?
-
Aug 7th, 2005, 10:34 PM
#10
Re: Query on Connection object in ADO.Net
An open connection is like an open door: anyone can go in or out at any time. It would be considered "more correct" to only open the door when it is necessary.
-
Aug 7th, 2005, 10:36 PM
#11
Re: Query on Connection object in ADO.Net
That is a nice illustration there.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|