High level data access question

M

mikekissman

In web pages that require many calls to a database is it better to hold
the connection open while all the calls are completed, or should the
connection be opened and closed for each query? It seems like the
former is the obvious choice, but whenever I try to create re-usable
data driven controls it seems easier to go with the latter.
 
M

Marina

That depends on how things are structured.

If all the data calls are in one method and all one after the other without
a lot of processing in between, then you open the connection, make all the
calls, and close it.

If each data call is in its own method, then you are better off having each
method manage its own connection. This will scale better and be far more
maintanable in terms of code.
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top