DB Connections in ASP.net ?

Good evening all,

Have a question about coonections. We are disscusing two ways;

1] Open the connection. Run your SQL. Close the connection.
This done is a function or sub.


2] Open connection on page load/Init.
It stays open during life of page. When you move from page to another one or when browser is killed you
then close the connection.

Which is the best way?
Life of page? While it is shown on client Browser?
is life of page ended when it is completely loaded in client browser.
If so if you closed the connection in a finished page event would that be better then
opening a connection, doing the SQL cmd, disposing of the connection in a fucntion or procedure.

Hope this all made sense. Its just ever where I read it says open it, do it, then kill it.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!