Public Class Form1 Dim dt As New DataTable Dim dt1 As New DataTable Dim connStr As String = "Provider = Microsoft.ACE.OLEDB.12.0; Data Source = test.ACCDB" Private sqlStr1 = "SELECT * FROM Customer" Private sqlStr2 = "SELECT * FROM Test" Private Sub Load(...) Handles Button1.Click Dim dataAdapter As New OleDb.OleDbDataAdapter(sqlStr1, connStr) dataAdapter.Fill(dt) DataGridView1.DataSource = dtEnd Sub Private Sub Move(...) Handles Button2.Click dt1 = dt.Copy DataGridView2.DataSource = dt1End Sub Private Sub Update(...) Handles Button3.Click Dim dataAdapter As New OleDb.OleDbDataAdapter(sqlStr2, connStr) Dim commandbuilder As New OleDb.OleDbCommandBuilder(dataAdapter) dataAdapter.Update(dt1)End SubEnd Class
Public Class Form1 Dim dt As New DataTable Dim dt1 As New DataTable Dim connStr As String = "Provider = Microsoft.ACE.OLEDB.12.0; Data Source = test.ACCDB" Private sqlStr1 = "SELECT * FROM Customer" Private sqlStr2 = "SELECT * FROM Test"
Private Sub Load(...) Handles Button1.Click Dim dataAdapter As New OleDb.OleDbDataAdapter(sqlStr1, connStr) dataAdapter.Fill(dt) DataGridView1.DataSource = dtEnd Sub Private Sub Move(...) Handles Button2.Click dt1 = dt.Copy DataGridView2.DataSource = dt1End Sub Private Sub Update(...) Handles Button3.Click Dim dataAdapter As New OleDb.OleDbDataAdapter(sqlStr2, connStr) Dim commandbuilder As New OleDb.OleDbCommandBuilder(dataAdapter) dataAdapter.Update(dt1)End SubEnd Class
Private Sub Load(...) Handles Button1.Click Dim dataAdapter As New OleDb.OleDbDataAdapter(sqlStr1, connStr) dataAdapter.Fill(dt) DataGridView1.DataSource = dtEnd Sub
Private Sub Move(...) Handles Button2.Click dt1 = dt.Copy DataGridView2.DataSource = dt1End Sub
Private Sub Update(...) Handles Button3.Click Dim dataAdapter As New OleDb.OleDbDataAdapter(sqlStr2, connStr) Dim commandbuilder As New OleDb.OleDbCommandBuilder(dataAdapter) dataAdapter.Update(dt1)End Sub
End Class