DB Connections in ASP.net ? - Programmers Heaven

Howdy, Stranger!

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


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

DB Connections in ASP.net ?

tirnaogtirnaog Posts: 26Member
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.