zip the db on exit

G

Guest

hello all
i'm using vb2005
i want my application to unzip the db file uppon startup (which i managed to
do quite right) and place in the right folder, then, when program ends, to
zip it and keep it in a different folder.
as i said, the login form does the job quite well for the unzip proccess,
but when i try to zip it at the end the file "is in use" and cannot be
copied. how can i release it from the application? while it is still running?
thankx
Erez.
 
G

Guest

Erez said:
hello all
i'm using vb2005
i want my application to unzip the db file uppon startup (which i managed to
do quite right) and place in the right folder, then, when program ends, to
zip it and keep it in a different folder.
as i said, the login form does the job quite well for the unzip proccess,
but when i try to zip it at the end the file "is in use" and cannot be
copied. how can i release it from the application? while it is still running?
thankx
Erez.

How are you opening the file? What type of DB is it? Do you do a
connection.close?

Chris
 
G

Guest

I Don't Like Spam said:
How are you opening the file? What type of DB is it? Do you do a
connection.close?

Chris

hello chris
the db file is a sqlexpress mdf file (the zip file holds both the mdf and
ldf files)
i dont explicitly open the connection, it's opened the first time i access
the dataset (i created with the add new data source wizard)
i was looking for the right connection.close code but i cant find where is
this connection that i'm supposed to close
Erez.
 
I

Ian Ashworth

AFAIK if SQL Server 2005 works in the same which in which MSSQL 2000 works
the MDF file is "attached" to the Server and even when your application ends
SQL Server still has the MDF file in use.

Again, not sure if 2005 is the same but you might want to look up the BACKUP
DATABASE T-sql commands or if you really do want to take it completely
offline (don't know why you would) you might want to look into the system
stored procedure sp_detach_db

Hope this information is of help to you.

Regards

Ian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Moving/deleting the DB upon close 1
Zip files using VB6 5
XP Zip Problem 5
Create Zip file for mailing 2
Extracting Windows Media Zip File 1
windows zip 3
create zip files 1
Reassociating Zip files 5

Top