Using only one connection for several forms with VS.NET

  • Thread starter Thread starter Trygve Lorentzen
  • Start date Start date
T

Trygve Lorentzen

Hi,

I have several forms in my project now, each with it's separate connection
to a DB. I would like to have only one connection in a form or class that
can be used by all the other forms and still be able to use the VS wizards
for DataAdapter creation etc. I would also like to use the same DataAdapters
and DataSets accross multiple forms.

How can I do this most efficiently? Any good articles on this? I have not
found any good information about this on the web yet. Any tips, hints, links
or help will be greatly appreciated. Thanks in advance!

Cheers,
Trygve
 
Hi,

I do not think that keeping connection in a global.asax is a good idea.
First of all this is not from the scalability point of view. Second, there
is not reason to keep connection open, when other users need it as well.
Each opened connection requires additional resources and does not come for
free.
 
I would agree although have seen some apps set up this way. The current app I am working on uses 6 different connections (private), all with the same connection string so should take full advantage of .NET pooling.
 
Back
Top