I have a class that executes a SQL stored procedure, supplying it with parameters. The sp is used for updating individual DB records and is executed every time a user clicks an update button; quite often.
My question is, where should I open the DB connection? I'm relucted to use an existing open public Connection
from a Module (if for no other reason than it is not conventional), but the alternative is to open the DB connection for every new instance of the class, ie every time a user updates a record. However, doing it this way I'm conerned about the overhead involved in continually opening and closing a DB connection.
I thought I might be able to pass an already open DB connection to a Connection property in the class but that doesn't seem possible.
Could someone advise me on the correct appraoch to DB connectivity in classes.
Thanks in advance,
Yael
My question is, where should I open the DB connection? I'm relucted to use an existing open public Connection
from a Module (if for no other reason than it is not conventional), but the alternative is to open the DB connection for every new instance of the class, ie every time a user updates a record. However, doing it this way I'm conerned about the overhead involved in continually opening and closing a DB connection.
I thought I might be able to pass an already open DB connection to a Connection property in the class but that doesn't seem possible.
Could someone advise me on the correct appraoch to DB connectivity in classes.
Thanks in advance,
Yael