I am trying to know what remains tied to the database. I have an application which starts, does some selects, and from a button I need to restore a new copy of the database. That cannot be performed as the procedure confirms the database cannot be used exclusively.
I made a small adjustment to the data model to avoid any process at startup. If this is the case, I can execute the procedure properly.
However, I need to find what causes the data class to have an object linked to the database.
I am using an approach like this for each select:
Using loSQLConnection As New SqlConnection(oApp.aConnection(nConnectionString, 1))
oCommand.Connection = loSQLConnection
oDataAdapter.Fill(oDataSet)
End Using
I always assumed the connection was created on demand and close immediately.
Each of the select using that code performs other procedures such as dumping the first record find into a datarow. But, once the datarow is initialized, there shouldn't be any link remaining with the code that was executed in the Using\End Using syntax.
Anyone could have an idea what is the cause there would be an open connectivity to the database?