Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

ADO Connections

İ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

  • baroonbikasbaroonbikas Member Posts: 7
    I would like to say I am using option 1 regularly without any problem.
    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.
Sign In or Register to comment.