Question Need help with copying .mdf database files

SylvainRicher

New member
Joined
Apr 12, 2009
Messages
2
Programming Experience
10+
Hi,

...Need help!

I have written a windform application using Visual Studio 2005, VB.NET and SQL Express for the database.

The application is installed on 5 Laptop computers; I need to be able to copy the database (.mdf) from on Laptop to another.

The problem I am having is that once the application is installed on the Laptops, I can not find the database file. The application is working well, but the database seem to be hided somewhere.

Some of my tables in my SQL database contain Image type items. So I can not simply download the data into ASCII files and then reload from those ASCII files.

Is there a simple way, if possible from VB.NET, to copy my database from on Laptop to another?

Note: Those Laptops do no have network connection.


Thank you!

Sylvain
 
Sure, you can use System.IO.File.Copy() to simply copy a file. Although one would think you're installer would put the DB where it needs to be upon installation.
 
I am creating the installation package using the "Publish" option in VS 2005.

When I install the applicaiton on the other Laptops, I can not find the .mdf file (Database).

I forgot to say that I am using the variable |DATADIRECTORY| in my connection string, so I do not know were the installer put the database.

I have done a "Search for File" (*.mdf) on one of the Laptop and it did not
find the database.

So I can not use System.Io.File.Copy() if the database is hidden.

Sylvain
 
Back
Top