Hi EveryOne,
What is the best approach for data access while developing applications
using Windows Forms ? Is it opening, working with and closing a new
SQLconnection and SQLcommand object everytime a DB access is needed , or
maintaining a single open connection/command object at the application level
( one for each user ) and then just reusing it again and again. The
connection string that the connection will use can be assumed to be static.

Signature
Vedanshu Mandvikar
C.C. (aka Me) - 27 Jan 2006 00:04 GMT
It depends on what your requirements are.
If your user will be making a lot of changes/queries in a short amount of
time then it is probably better to keep the connection open.
If they perform a query and then process the datal locally for a while
before interacting with the DB again then it might be better to close it and
reopen when it as needed.
Keeping a connection open, when it is not going to be used for a while, is a
waste of server resources on the DB side.

Signature
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Charles Cox
VC/VB/C# Developer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Hi EveryOne,
>
[quoted text clipped - 6 lines]
> connection string that the connection will use can be assumed to be
> static.