Before calling da.Update, try executing a loop:
For j As Integer = 0 To ds.Tables(0).Rows.Count – 1
ds.Tables(0).Rows(j).SetAdded()
Next j
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am trying to update multiple tables from local mysql database to remote mysql database. Following code I am using for insert/update the remote table.
But table is not inserted/updated.
Dim tblStr As String = "select id,tablename from transtablename"
Dim transtblDT As DataTable = RetDatatable(tblStr, <<Local Connection String>>)
For i As Integer = 0 To transtblDT.Rows.Count - 1
Dim ds As New DataSet
strSql = "select * from " & transtblDT.Rows(i).Item("tablename").ToString
Using mcon As New MySqlConnection(<<Local Connection String>>)
Dim da As New MySqlDataAdapter(strSql, mcon)
mcon.Open()
da.Fill(ds, transtblDT.Rows(i).Item("tablename").ToString)
mcon.Close()
End Using
Using mcon As New MySqlConnection(<<Remote Connection String>>)
Dim da As New MySqlDataAdapter("SELECT * FROM " & transtblDT.Rows(i).Item("tablename").ToString, mcon)
Dim cb As New MySqlCommandBuilder(da)
mcon.Open()
da.Update(ds, transtblDT.Rows(i).Item("tablename").ToString)
mcon.Close()
End Using
Next
Requesting your help how to resolve this issue.
Before calling da.Update, try executing a loop:
For j As Integer = 0 To ds.Tables(0).Rows.Count – 1
ds.Tables(0).Rows(j).SetAdded()
Next j