MySQL Forums
Forum List  »  MySQL for Visual Studio

copy bulk data from mysql to access table vb.net
Posted by: fahad sindhu sindhu
Date: October 10, 2019 05:41AM

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

Options: ReplyQuote


Subject
Views
Written By
Posted
copy bulk data from mysql to access table vb.net
1262
October 10, 2019 05:41AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.