How to close all open "handles" to a SQL Server 2005 express DB?

Hello all!
I'm trying to create an application which makes a copy of the database file it is using on application start and can restore it at any time, if needed (little project about SQL injection, so I need the copy ;-) ). This works fine, but as soon as I make my first connection to the db (connection_object.open()) and close it again I can not access the file anymore, because it is "in use by another process". How can I release all handles from the database, so that I can replace the DB file with it's backup copy

Thank you

Kolja


Answer this question

How to close all open "handles" to a SQL Server 2005 express DB?

  • copier_guy

    Ahm...
    cal me a noob, but I disposed it and set the variable to null... doesn't work
    What do you mean : Call GC

  • Balu Vasudev

    You have to kill connection instead of just closing.

    Shot two bulets in his head and call GC to finish him.
    Smile


  • How to close all open "handles" to a SQL Server 2005 express DB?