我的表单中有Dataset
。我使用dataset.getchanges()
方法来获取数据集中的更改。即使Dataset
中没有任何更改,它也总会返回一些更改。我尝试了各种方法来检测更改发生的位置,但未成功。
请帮帮我。
这是我的代码片段
Dim newds As DataSet
newds = dss.GetChanges()
MsgBox(newds.ToString())
If newds IsNot Nothing Then
Dim i As Integer = adap1.Update(newds, "dataview")
If i > 0 Then
MessageBox.Show(i & " Record(s) Updated Sucessfully", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
编辑[1]:这是dss
代码:
adap1 = New OleDbDataAdapter("select th.catalogue,th.name,pa.party_catalogue,pa.rate" _
& " from party_catalogue pa,itemhead th where pa.itemcode=th.itemcode and pa.party_code=" & a, conn)
dss = New DataSet
dss.Clear()
adap1.Fill(dss, "dataview")
DataGridView1.DataSource = dss.Tables(0)