¤ Hi everyone,
¤ I need to know how to copy a ms access table from database A to database B
¤ using ado.net in vb.net. What classes of the OLEDB namespaces will allow me
¤ to do this? Can you please provide a code sample?
¤ Thanks for your help.
The following code will copy tables and their data from one access database to another. However, it
will not create indexes or relationships. If you need to create those you will need to execute some
Access SQL DDL statements.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnacc2k/html/acfundsql.asp
Function ExportAccessToAccess() As Boolean
Dim AccessConn As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;"
& _
"Data Source=e:\My Documents\db1.mdb")
AccessConn.Open()
Dim AccessCommand As New System.Data.OleDb.OleDbCommand("SELECT * INTO [MS
Access;DATABASE=E:\My Documents\db10.mdb;].[Table1] FROM Table1", AccessConn)
AccessCommand.ExecuteNonQuery()
AccessConn.Close()
End Function
Paul
~~~~
Microsoft MVP (Visual Basic)