|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DBAccess in WinFormsHi 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. -- Vedanshu Mandvikar 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. -- Show quote~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Charles Cox VC/VB/C# Developer ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Vedanshu Mandvikar" <vedan***@gmail.com> wrote in message news:2577EC48-2848-41D3-8221-B911A7FEB85D@microsoft.com... > 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. > > -- > Vedanshu Mandvikar |
|||||||||||||||||||||||