dseydel Posted November 18, 2003 Posted November 18, 2003 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. Quote
Moderators Robby Posted November 18, 2003 Moderators Posted November 18, 2003 You can use an Insert with ExecuteNonQuery. Quote Visit...Bassic Software
dseydel Posted November 18, 2003 Author Posted November 18, 2003 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! Quote
Moderators Robby Posted November 18, 2003 Moderators Posted November 18, 2003 Here are few examples . . http://www.w3schools.com/sql/sql_select_into.asp Quote Visit...Bassic Software
dseydel Posted November 18, 2003 Author Posted November 18, 2003 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 Quote
Moderators Robby Posted November 19, 2003 Moderators Posted November 19, 2003 No problem, the rest of their website (w3shools.com) has many more fundementals on ASP, Jscript, HTML, etc... Quote Visit...Bassic Software
ajaikumarr Posted December 29, 2003 Posted December 29, 2003 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 Quote
Moderators Robby Posted January 5, 2004 Moderators Posted January 5, 2004 Use 'Insert Into Table1' instead of Select Quote Visit...Bassic Software
ajaikumarr Posted January 7, 2004 Posted January 7, 2004 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.