views:

1089

answers:

2

Hi how to copy all the tables from one mdb file to an other blank mdb file using C# code can anybody please help with the code?

Hi

Thanks for the file copy suggestion but after executing that query am getting this error"

 Error 1 Invalid token '(' in class, struct, or interface member declaration    
 C:\Documents and Settings\E457808\My Documents\Visual Studio 2005
 \Projects\19032009\trymdbpulling\WindowsApplication1\Form1.cs  
 21 28 WindowsApplication1
+2  A: 

Wouldn't it be easier to just copy the file, e.g.

System.IO.File.Copy("source.mdb", "dest.mdb");

If you want only the structure without the data, you could make a template database with just the tables and copy from that.

Julien Poulin
I need to copy the tables along with the data in it.
Then you can use the code above, it will be far easier and faster than reading every table and making sql queries
Julien Poulin
A: 

See this example of bulk copying: http://www.codeproject.com/KB/cs/CopyDBSchemaUsingSMO.aspx

Greg