none
copy bulk data from mysql to access table vb.net RRS feed

  • Question

  • Dim table As New DataTable Dim sourceConnection As New MySqlConnection("MySQL cnnection string here") Dim selectCommand As New MySqlCommand("SQL SELECT statement here", sourceConnection) Dim destinationConnection As New OleDbConnection("Access connection string here") Dim insertCommand As New OleDbCommand("SQL INSERT statement here", destinationConnection) 'Add parameters to insertCommand here, e.g. insertCommand.Parameters.Add("@ColumnName", OleDbType.VarChar, 50, "ColumnName") Dim sourceAdapter As New MySqlDataAdapter With {.SelectCommand = selectCommand, .AcceptChangesDuringFill = False} Dim destinationAdapter As New OleDbDataAdapter With {.InsertCommand = insertCommand} sourceAdapter.Fill(table) destinationAdapter.Update(table) what to put in line as sql query cause i have multiple rows with diffrent data Dim insertCommand As New OleDbCommand("SQL INSERT statement here", destinationConnection) i tried for i =0 to listbox2.items.count listbox2.selectedindex=i Dim insertCommand As New OleDbCommand("insert into approed (id, word, approeds) values (0, listbox2.selecteditem, 'no' )", destinationConnection) i=i+1 next but not works i have to copy all mysql records to access table

    thanks in advance

    Thursday, October 10, 2019 11:28 AM