Click here to Skip to main content
15,915,508 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone. I need help about my coding in vb.net copying data from one database table to another database table in ms access database.

Here are my codes:
VB
Dim conn2 As OleDbConnection
       Dim cmd2 As OleDbCommand
       Dim SQLStr2 As String


        conn2 = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source= '" & TextBox3.Text & "' ;Jet OLEDB:Database Password=cscfo13poppsi; ")


       SQLStr2 = "SELECT * FROM pop IN '" & TextBox3.Text & "'"
       conn2.Open()
       cmd2 = New OleDbCommand(SQLStr2, conn2)
       cmd2.ExecuteNonQuery()

       Dim conn As OleDbConnection
       Dim cmd As OleDbCommand
       Dim SQLStr1 As String

       conn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=psipop.accdb;Jet OLEDB:Database Password=cscfo13poppsi;")
       SQLStr1 = "INSERT INTO pop 'psipop'"
       conn.Open()
       cmd = New OleDbCommand(SQLStr1, conn)
       cmd.ExecuteNonQuery()


The error is "syntax error in INSERT INTO"

What I have tried:

I've tried all possible codes but nothing works.
Posted
Updated 30-Jul-16 5:14am

In SQLStr1 you have to specify the values to be inserted.

"INSERT INTO pop 'psipop' values (value1, value2, .... )"
 
Share this answer
 
Friends, I've found a solution for this matter and it works for me.
Try to visit this link: Copy records from one database to another-VBForums[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900