Moving/deleting the DB upon close

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

dear all
i'm using vb2005 and SSE.
using the application's startup event, i'm copying the db file (.mdf) to
it's location (a ram-drive). that seems to work fine (i only connect to it
after a successful login, so it doesnt "know" the db is not there...)
then, using the application's shutdown event, i want to copy it back to it's
permanent lodge (the hard drive). this doesnt work. whatever i try to do with
the file/folder, the file is in use (i guess by the app?) and cant be
copied/deleted/moved

what should i do to set it free? i cant find where is the connection that
needs to be closed. (cause i never explicitly opened it)

thanx in advance,
Erez.
 
Erez said:
dear all
i'm using vb2005 and SSE.
using the application's startup event, i'm copying the db file (.mdf) to
it's location (a ram-drive). that seems to work fine (i only connect to it
after a successful login, so it doesnt "know" the db is not there...)
then, using the application's shutdown event, i want to copy it back to it's
permanent lodge (the hard drive). this doesnt work. whatever i try to do with
the file/folder, the file is in use (i guess by the app?) and cant be
copied/deleted/moved

what should i do to set it free? i cant find where is the connection that
needs to be closed. (cause i never explicitly opened it)

thanx in advance,
Erez.

You did open it. It may be happening in the designer generated code
though. Look throught the code in that region and you should see your
connection. However as was posted to you before, Sql server may be
(read: probably) locking the data files. You will have to find a way to
shutdown Sql Server to free the file.

Chris
 
Back
Top