SQL Server Connection Best Practice

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, generally, is it better to quickly open and close ADO.NET a few times
or open the connection once. Perhaps my understanding of pooling and
disconnected data is not where I'd like it.

An example is let's say there is an ASP.NET page with a page_load event and
button_click event. One could open/close connections at each event or just
open the connection once.

Which is more efficient? Does the first way create more SPIDs in SQL server?
Is that bad?

Thanks in advance,
Jim
 
Two of the central ideas behind ADO.Net are disconnected data and pooled
connections. Open/close as needed. Keep your connection string syntax
identical.
 
Back
Top