İs it better in VB to :
1.open a connection and use it every time to access a db and close it when we exit the program
or
2.open a connection when we need to access the db and close it when we finish our job.(Making several open-close connections inside the program)
Which one is better for the performance?
Comments
It makes sense to open connection to db only a time as afterward it is only needed to use command object or recordset object for db manipulation. So open a connection to db at startup and close at exit.
May be you would like to include a error handler for command and recordset operations to reopen the db connection in case any error occurs.