PDA

Click to See Complete Forum and Search --> : ADO.NET Update Operation


grantc2
Feb 9th, 2003, 12:31 AM
As an example, I have one combobox and a textbox on a form. The textbox is bound to a row in a DB table. I can run the app and when I select an item in the combobox, the textbox is filled with the respective data. I used:

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
Me.BindingContext(DsCustomerFullName1, "customer").Position = ComboBox1.SelectedIndex
End Sub

I have a label on the form with this procedure to update changes:

Private Sub lblUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblUpdate.Click
If Not DsCustomerFullName1.GetChanges(DataRowState.Modified) Is Nothing Then
adapterFullName.Update(DsCustomerFullName1.GetChanges(DataRowState.Modified))
MsgBox("Changed!")
End If
End Sub

Now, when I run the app, I can change the data in the textbox and click Update. However, I don't get my MsgBox prompt. Hence my data not being updated. Does this make since? Any suggestions?

Hay_Dez
Feb 9th, 2003, 09:06 AM
well because the data set doesn't see that row was modified , it is still in memory I had the same issue you do,

must change the row

So if you only have 1 record u need to change it to EOF or BOF
Other wise just click another record for the dataset to see the field has bee modifed then u can update

hope it helps