我正在将文本框绑定到数据集表字段
e.g。
txtFirstName.DataBindings.Add(New Binding("Text", dsCustomers, "Customers.FirstName"))
当他们点击编辑按钮时,我允许字段可编辑,当他们点击取消我想要摆脱更改,所以我想我可以将数据表窗口设置回原来的位置,但是更改不会被丢弃,我甚至尝试重新填充数据表
Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click
Dim strSQLCmd As String = "Select * From Customers"
DBAdaptCustomers = New OleDbDataAdapter(strSQLCmd, strConn)
dsCustomers.Tables.Clear()
DBAdaptCustomers.Fill(dsCustomers, "Customers")
BindingContext(dsCustomers, "Customers").Position = currentPosition 'I save the position before editing
ToggleButtons()
ToggleTextBoxEnabled()
txtId.Enabled = False
End Sub
我希望这很明确,我在处理这个问题时遇到了麻烦。为什么不显示原始数据?