Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Opening and Closing Connections: Opinions
Message
 
To
05/04/2002 15:43:29
Jason Dalio
Northern Interior Regional Health Board
Prince George, British Columbia, Canada
General information
Forum:
Visual Basic
Category:
Database DAO/RDO/ODBC/ADO
Miscellaneous
Thread ID:
00641612
Message ID:
00641661
Views:
12
If we are talking of a regular client/server application, I like to have one class that have all my methods to access the database (open/close connection, get recordset, exec query, ...). I have one connection private to this class that I leave open as long as the class is in memory. I often create a global variable in my that contains an instance of this class so that my connection is opened from the beginning to the end.


>I was wondering if people would like to comment on how they like to deal with connection and recordset objects. Myself, I have recently been putting a public variable in a module that is the provider string and then utilizing that variable when opening my connection object. This works fine and keeps it in one place. Up until my most recent app I hve usually just put a Conenction object at the form level and had all recordsets in procedural code use this one object. Now I am building a new app I am toying with creating and destroying connection objects within my procedural code as I go. Can anyone comment on "best practice" (if there is one) for when and how often to create connections and recordsets?
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Reply
Map
View

Click here to load this message in the networking platform