SQL Server Connection Best Practice

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
 
E

Earl

Two of the central ideas behind ADO.Net are disconnected data and pooled
connections. Open/close as needed. Keep your connection string syntax
identical.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top