Copying a database in MSDE...

lidds

Well-known member
Joined
Nov 9, 2004
Messages
210
I have the need to copy a database in MSDE using vb.net code, and I was wondering if anyone has done this that would not mind sharing the code.

I think the process would be something like:

1) Determine location of .mdf and .ldf file that you wish to copy
2) Detach database that you wish to copy
3) Copy the .mdf and .ldf file and rename to new name
4) Attach both the new and old database

As I quite new to vb.net the major problem that I can see with this is error handling, as you would always want the database that you are copying to be re-attached to SQL server.

Any help on this subject would be appreshiated.

Thanks

Simon
 
Back
Top