Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
I am trying to find a way to copy an Access database table from one database to another in VB.Net. Is there a way to do this short of doing an SQL Create of all of the columns & then a read-write of the data? I can clone/copy the table in code, but I can't find a way to commit the table created to the database. Any help appreciated.
Posted
I had looked at the Insert/ExecuteNonQuery but the examples I found relate to inserting columns. Do you mean that the Insert can be used to Insert a Table? If so, I would appeciate a code snippet that would give the sytax. Thanks for your help!
Posted

Robby - thanks so much for your help! The Select Into works. That's a very valueable resource - I got a lot of additional ideas from the SQL Code samples that will make several other tasks much easier. Thanks again,

Don Seydel

  • 1 month later...
Posted

Not able to insert records on different table

 

Hai,

 

I tried to insert records on 2nd table using the following query

SELECT Table1.* INTO Table1 IN 'C:\MyDB.Mdb' FROM Table1, but it's throwing error like below

 

An unhandled exception of type 'System.Data.Odbc.OdbcException' occurred in system.data.dll

 

Could you please guide me to handle this.

 

Thanks in advance.

Ajai Kumar .R

Posted

Hai,

 

No Luck, I'm getting same error message.

 

I've included the code below.

------------------------------------

Dim ConnectString As String

Dim ConnectionObject As System.Data.Odbc.OdbcConnection

ConnectString = "Driver={Microsoft Access Driver (*.mdb)}; Dbq=C:\2.mdb; Uid=Admin; Pwd= Password"

ConnectionObject = New System.Data.Odbc.OdbcConnection(ConnectString)

Call ConnectionObject.Open()

 

svlQuery = "Insert INTO Table1 IN 'C:\1.Mdb' FROM Table1"

Dim CommandObject As New System.Data.Odbc.OdbcCommand(svlQuery, DatabaseFunctions.ConnectionObject)

Call CommandObject.ExecuteNonQuery()

CommandObject.Dispose()

CommandObject = Nothing

 

Thanks in Advance.

Ajai

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...