"Save" default Access DB as new Database  
Author Message
Christie Myburgh





PostPosted: .NET Framework Data Access and Storage, "Save" default Access DB as new Database Top

I am writing an app with VS2005(VB.Net) that must access an existing MS Access database, create a table and import a text file into the newly created table. The app must then save the existing default database as a new DB with the "user supplied" name.

My question: Is it possible to save an existing Access DB as a new Access DB using ADO.Net If not what would be the best way to achieve this

Thanks

Christie




.NET Development11  
 
 
Bappi





PostPosted: .NET Framework Data Access and Storage, "Save" default Access DB as new Database Top

Using ADO.net u can't save the file as Access DB. Instead u can use System.IO.Copy method to perform the task.

 
 
Matt Neerincx





PostPosted: .NET Framework Data Access and Storage, "Save" default Access DB as new Database Top

Yes there is no "Save As" with ADO.NET and Access database.

Possible options:

1. Like poster indicated above, make a physical copy of the database.

2. Create a new database and copy the tables into the new database, see for example:

http://www.codeguru.com/vb/gen/vb_database/microsoftaccess/article.php/c5149/

Note a little known tsql trick to copy table from one database to another (works with Jet provider):

"insert into [c:\db1.mdb].[table1] select * from [c:\db2.mdb].[table1]"

Matt



 
 
Christie Myburgh





PostPosted: .NET Framework Data Access and Storage, "Save" default Access DB as new Database Top

Thanks...will do