G
Guido Kraus
I have a strongly-typed DataSet that contains a
DataTable 'Customers' that is populated by a database.
The user can edit this table via DataGrid.
I want to supply a 'Refresh' button, that queries the
database and updates my DataTable to reflect the latest
changes other users may have made. Of course, I don't
want to lose the changes the current user has made and
which are not saved yet.
For this to work I use the Merge() method of the DataSet
in the following way:
Dim tempTable As New myDataSet.CustomersDataTable
myCustomersDataAdapter.Fill(tempTable)
MyDataSet.Merge(tempTable, True,
MissingSchemaAction.Ignore)
The problem is that after merging _all_ rows in my
target 'Customers' DataTable have a RowState
of 'Modified'. Even worse, the target 'Customers'
DataTable does not reflect the changes that were loaded
into the tempTable. In other words, immediately after
filling the tempTable contains all customers from the
database and all rows have RowState=Unchanged. After
merging with the target table, the target table does not
show the current changes. Instead all rows in the target
table have RowState=Modified.
BTW, I tested the merge operation with the second
parameter set to False. In this case, everything works as
excepted. However, this is no solution because the user's
changes would be overwritten by the version from the
tempTable.
Any ideas?
Thanks,
Guido
DataTable 'Customers' that is populated by a database.
The user can edit this table via DataGrid.
I want to supply a 'Refresh' button, that queries the
database and updates my DataTable to reflect the latest
changes other users may have made. Of course, I don't
want to lose the changes the current user has made and
which are not saved yet.
For this to work I use the Merge() method of the DataSet
in the following way:
Dim tempTable As New myDataSet.CustomersDataTable
myCustomersDataAdapter.Fill(tempTable)
MyDataSet.Merge(tempTable, True,
MissingSchemaAction.Ignore)
The problem is that after merging _all_ rows in my
target 'Customers' DataTable have a RowState
of 'Modified'. Even worse, the target 'Customers'
DataTable does not reflect the changes that were loaded
into the tempTable. In other words, immediately after
filling the tempTable contains all customers from the
database and all rows have RowState=Unchanged. After
merging with the target table, the target table does not
show the current changes. Instead all rows in the target
table have RowState=Modified.
BTW, I tested the merge operation with the second
parameter set to False. In this case, everything works as
excepted. However, this is no solution because the user's
changes would be overwritten by the version from the
tempTable.
Any ideas?
Thanks,
Guido