D
diesel
I've got a DataTable called dtOrders that is populated with orders from
an Access table. There is an associated DataView called dvOrders, which
stores a single record (the current order). I have several text fields
bound to this DataView, as follows:
Dim bindOrderID As Binding
txtOrderID.DataBindings.Clear()
bindOrderID = New Binding("Text", dvOrders, "order_id")
txtOrderID.DataBindings.Add(bindOrderID)
Dim bindOrderSKU As Binding
txtOrderSKU.DataBindings.Clear()
bindOrderSKU = New Binding("Text", dvOrders, "sku")
txtOrderSKU.DataBindings.Add(bindOrderSKU)
Dim bindPaymentsDate As Binding
txtPaymentDate.DataBindings.Clear()
bindPaymentsDate = New Binding("Text", dvOrders, "payments_date")
txtPaymentDate.DataBindings.Add(bindPaymentsDate)
Etc...
There is a save button that the user can click to save changes to an
order to the db. The problem is that when the user makes changes and
clicks Save, the DataTable isn't seeing the changes.
This is the code that runs when the user clicks save:
Dim da1 As New OleDbDataAdapter
BindingContext(dtOrders.DataSet).EndCurrentEdit()
If Not dtOrders.GetChanges Is Nothing Then
da1.Update(dtOrders)
End If
It never gets to the Update, because the changes never seem to
register. I've tried changing the focus, moving to another record,
etc. but nothing seems to convince the DataTable that changes have been
made.
Any help would be appreciated.
an Access table. There is an associated DataView called dvOrders, which
stores a single record (the current order). I have several text fields
bound to this DataView, as follows:
Dim bindOrderID As Binding
txtOrderID.DataBindings.Clear()
bindOrderID = New Binding("Text", dvOrders, "order_id")
txtOrderID.DataBindings.Add(bindOrderID)
Dim bindOrderSKU As Binding
txtOrderSKU.DataBindings.Clear()
bindOrderSKU = New Binding("Text", dvOrders, "sku")
txtOrderSKU.DataBindings.Add(bindOrderSKU)
Dim bindPaymentsDate As Binding
txtPaymentDate.DataBindings.Clear()
bindPaymentsDate = New Binding("Text", dvOrders, "payments_date")
txtPaymentDate.DataBindings.Add(bindPaymentsDate)
Etc...
There is a save button that the user can click to save changes to an
order to the db. The problem is that when the user makes changes and
clicks Save, the DataTable isn't seeing the changes.
This is the code that runs when the user clicks save:
Dim da1 As New OleDbDataAdapter
BindingContext(dtOrders.DataSet).EndCurrentEdit()
If Not dtOrders.GetChanges Is Nothing Then
da1.Update(dtOrders)
End If
It never gets to the Update, because the changes never seem to
register. I've tried changing the focus, moving to another record,
etc. but nothing seems to convince the DataTable that changes have been
made.
Any help would be appreciated.