SQLBase でいくつかの値を選択しましたが、それらを MySQL にインポートしたいと考えています。しかし、私のタイトルに示されているように、問題は解決しません。
シナリオは次のとおりです。SQLBase でいくつかのフィールドとその値のみを選択し、それらを MySQL に挿入する必要があります。sqlbase データを mysql にインポートするにはどうすればよいですか?
これが私のコードです:
Dim conn As New SQLBaseConnection("DB=Source;SERVER=SERVER1;UID=SYSADM;PWD=password;INI=C:\Program Files\Gupta\SQLBase901\sql.ini")
Try
conn.Open()
Dim adaptor As New SQLBaseDataAdapter
Dim ds As New DataSet
adaptor.SelectCommand() = New SQLBaseCommand("SELECT * FROM PERSON WHERE TYPE='E'", conn)
ds = New DataSet()
adaptor.Fill(ds, "ID")
Dim datTable As DataTable = ds.Tables("ID")
Dim id, type, name, proximity, department, section, costCenter, lastName, firstName, midName, company As String
If datTable.Rows.Count > 0 Then
For i As Integer = 0 To datTable.Rows.Count - 1
id = datTable.Rows(i)(0)
type = datTable.Rows(i)(1)
name = datTable.Rows(i)(8)
proximity = datTable.Rows(i)(33)
department = datTable.Rows(i)(51)
section = datTable.Rows(i)(58)
costCenter = datTable.Rows(i)(55)
firstName = datTable.Rows(i)(3)
midName = datTable.Rows(i)(4)
lastName = datTable.Rows(i)(5)
company = datTable.Rows(i)(50)
Insert201(id, type, name, proximity, department, section, costCenter, lastName, firstName, midName, company, conn)
i += 1
Application.DoEvents()
Next
End If
conn.Close()
Catch ex As Exception
'TextBox1.Text = ex.Message
End Try
次に、別のサブ proc でこれを呼び出します。
Public Sub Insert201(ByVal id, ByVal type, ByVal name, ByVal proximity, ByVal department, ByVal section, ByVal costCenter, ByVal lastName, ByVal firstName, ByVal midName, ByVal company, ByVal conn)
Dim Query As String
Query = "INSERT INTO tbl_201 VALUES ('" + id + "','" + type + "','" + name + "','" + proximity + "','" + department + "', '" + section + "', '" + costCenter + "','" + lastName + "', '" + firstName + "', '" + midName + "','" + company + "')"
Try
conn.Open()
Dim sql As MySqlCommand = New MySqlCommand(Query, conn)
sql.ExecuteNonQuery()
'MsgBox("Record is Successfully Inserted")
conn.Close()
Catch ex As Exception
conn.Close()
MsgBox("Record is not Inserted" + ex.Message)
End Try
End Sub