Option (3) ;)
You should use a connection and then close it when you no longer need it. If
you have a group of calls you want to make, you can open the connection and
live it open until the rest of the steps are complete (as long as there is
no collision on the connection), but it is best if this time frame is short,
you would not want to leave connections open past the duration of the page
request. In this way you allow the ADO.NET handling of connection pooling
to function.
If you are using datasets, simply allow the adapter to open and close the
connections as required.
As a side note, make sure you close all your datareaders when you are
finished with them (if you use them at all).
--
Rocky Moore
www.HintsAndTips.com - Share your tips with the world!
~~~~~~~~~ Developer Tips Welcome! ~~~~~~~~~
"Vicky" <vi*********@rediffmail.com> wrote in message
news:#M**************@TK2MSFTNGP09.phx.gbl...
which one is better approach among the two listed below
1. Opening connection on each web page for doing some database transaction
2. Opening connection once and store it in application object, and then
refering this application object on each web page.
Thanks