hi guys. can you please check my codes..
i am currently working on a migration of a foxpro to a mysql database
but i have an error when i am executing my insert query. help me out.
i am currently working on a migration of a foxpro to a mysql database
but i have an error when i am executing my insert query. help me out.
VB.NET:
Dim myConnection As New MySqlConnection
Dim foxConnection As New OleDbConnection
Dim test1 As String = "z:\foxpro\" 'where resides the foxpro table
myConnection = New MySqlConnection("SERVER=" & My.Settings.DBSERVER & ";" _
& "DATABASE=testdata;" _
& "UID=user;" _
& "PWD=pass;")
Dim xFoxpro As String = "select strtran(dept_code,chr(39),'') as dept_code, strtran(desc,chr(39),'') as descr from dept"
Dim strSql As String = "insert into dept " & xFoxpro
Dim connCommand As New MySqlCommand
connCommand.CommandText = strSql & " Provider=VFPOLEDB;" + _
"Data Source= " & test1 & " ;" & _
"Collating Sequence=general;"
connCommand.Connection = myConnection
If connCommand.Connection.State <> ConnectionState.Open Then
connCommand.Connection.Open()
End If
connCommand.ExecuteNonQuery()