Question why oh why doesn't my update get called?

threeo

Member
Joined
May 26, 2010
Messages
15
Programming Experience
1-3
i have a vb.net winforms application. i have one particular form which has fields bound to a datasource and uses a bindingsourcenavigator. there is also a "save" button to save changes to any particular record.
when i run this application, i can hit the save button and my changes are saved just fine. when my users in another state hit the save button it works SOMETIMES.
i can turn sql server trace on and watch as i hit the save button and see the update called. but when my users hit the save button......no sql server activity occurs.
my users and i are both hitting a remote sql server.
what in the world could cause this issue?
it's the same code
hitting the same sql server database
the only thing i can think is that maybe either the datatable...or the bindingsource....or the bindingsourcenavigator.....is not registering that the data is dirty.
but it does for me!
so why not them?

i just can't explain it:confused:

here is my update sub:

Private Sub saveData()
Me.Validate()
Me.TblMyTableBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.DsMyDataset)
End Sub

this runs and generates no errors.....
BUT.....
the sql server update never fires!
 
Last edited:
Chances are that the database update is occurring but you are just looking in the wrong place or at the wrong time. Follow the first link in my signature and it should shed some light on the matter. If you still aren't sure, the first thing to do is test the return value of your call to UpdateAll. If that's not zero then data is being saved.
 
You have listed your .NET framework as 2.0 but 2.0 doesnt have TableAdapterManager. Please update your profile

Did you correctly register the relevant tableadapter with the manager? Are you absolutely sure that the dataset contains committed changes that must be saved to the database?

VB.NET:
Expand Collapse Copy
Me.Validate()
'if you have bound a grid to this bindingsource, call endedit on the grid too
Me.TblMyTableBindingSource.EndEdit()

Dim ds as DataSet = Me.DsMyDataSet.GetChanges()
If ds IsNot Nothing Then
  For Each dt as DataTable in ds.Tables
    MessageBox.Show(dt.Name & " table change count: " & dt.Rows.Count)
  Next
End If

Dim i as Integer = Me.TableAdapterManager.UpdateAll(Me.DsMyDataset)
MessageBox.Show(i & " rows affected during update")
 
Back
Top