我已经搜索了这个解决方案,发现答案非常接近,但无法解决我需要的问题。我有一个用 Access 表中的数据填充 datagridview 的表单。填充后,我需要将该信息附加到 sql server 中的表中。请问最好的方法是什么?谢谢你的帮助
这是我的代码;
'connect to access
Dim myDBconn As New OleDbConnection("connection details here")
' SQL Statement
Dim sql As String
sql = "SELECT * FROM tblCustomerUpdates"
Dim adapter As New OleDbDataAdapter(sql, myDBconn)
' Gets the records from Access table and fills adapter
Dim dt1 As New DataTable("CustomerDetails")
adapter.Fill(dt1)
Dim sql1 As String
sql1 = "SELECT * FROM tblCustomerDetails"
Dim adapter1 As New OleDbDataAdapter(sql1, myDBconn)
Dim cmd1 As New OleDbCommand(sql1, myDBconn)
myDBconn.Open()
Dim myreader As OleDbDataReader = cmd1.ExecuteReader
myreader.Read()
' DataSource for the DataGridView
DataGridView2.DataSource = dt1
'now need to grab data from the datagridview or adapter and append rows to a table in sql server?