Creating database connections - Do it once or for each query?

Posted by webnoob on Programmers See other posts from Programmers or by webnoob
Published on 2012-03-29T09:40:49Z Indexed on 2012/03/29 11:41 UTC
Read the original article Hit count: 227

Filed under:
|
|

At the moment I create a database connection when my web page is first loaded. I then process the page and run any queries against that conection. Is this the best way to do it or should I be creating a database connection each time I run a query?

p.s It makes more sense to me to create 1 connection and use it but I don't know if this can cause any other issues.

I am using C# (ASP.NET) with MSSQL.

© Programmers or respective owner

Related posts about c#

Related posts about database