Hakim Rachidi35,586 Points
Data base still in use error
After closing all programs and tabs that used the Database I still get the error saying that the Database can not be dropped because it is in use. When I watch the status of the server in sqllocaldb.exe I noticed that the connection is closing but only after some amount of time (5 - 10 min).
Is this normal or did I forget anything. I know I could just close it manually but why even is there a dispose method in the when it is not working properly.
Allan ClarkTreehouse Moderator 10,798 Points
the Dispose method should rarely be called directly. It is better practice to create the object with a 'using' statement. This will make sure the connection is closed even if the code is stopped or errored out before the Dispose method would be called.
Would need to see code to provide a more precise answer.