I have also had problems with the HasChanges Dataset method. I have a
similar situation, my master table is displayed in databound textboxes with
detail table in datagrid. For some reason changing the value in a databound
control changes the record in the dataset but the HasChanges still returns
I ended up copying code from a form created using the DataForm Wizard. This
generated code uses the GetChanges method of the dataset to create a new
dataset. It then checks if the new dataset is nothing. If it is not nothing
then changes have taken place and the db is updated. In this way they are
avoiding using the HasChanges method. Seems to suggest to me that Microsoft
is aware of this behaviour.
This is a copy of the code:
'Create a new dataset to hold the changes that have been made to the main
Dim objDataSetChanges As Dataset = New Dataset ()
'Stop any current edits.
'Get the changes that have been made to the main dataset.
objDataSetChanges = CType(objAgreements.GetChanges, Dataset )
'Check to see if any changes have been made.
If (Not (objDataSetChanges) Is Nothing) Then
' do update
Hope this helps....
> I figure that I'm probably not the first to ask this question, but
> if I could find an answer.
> I have a dataset which take data from two adapters. I've defined a
> relationship between the two tables and hence have set up a master/detail
> scenario. The master control is a datagrid and the detail controls are a
> bunch of text boxes.
> My problem is this, I can detect and update the database with any changes
> made in the datagrid (master), but I can't do it for any of the detail
> records. I know that the dataset is being updated as when I make a change
> (say someones address) and move to another record and come back the change
> is present. But I can't seem to find the right way to tell the database to
> get updated.
> Any help with this is would be tops