Which one is better while developing win-based application which uses a Database as its data store ? What about web-based applications?
1) when user loads he first form of an application, the global connection opens and by closing the last form of the application, the connection closes and disposes.
2) for every form within the application, there is a local connection (form scope) and when user wants to performs an operation like insert, update, delete, search, ... the application uses the connection and by unloading the form, the connection also closes and disposes.
3) for every operation within a form of an application, there is a local connection (procedure scope) and when user wants to performs an operation like insert, update, delete, search, ... the application uses procedure connection and at the end of every procedure within the form, the connection also closes and disposes.