CRM Development

Solutionist has designed the architecture for a new CRM system for use in the medical imaging industry.

Wednesday 11 March 2015

Why does my DataTable merge not work?

I was recently looking and some older DataTable code.
We were trying to merge an updated DataRow into an existing DataTable
But... it was having non of it - the changes didn't go in.

After some hunting it turned out that the RowState of both the existing and updated rows was "Modified".
So the merge didn't know what to do - what takes precedence?

The solution was to call AcceptChanges() on the existing DataTable before merging in the new data.
AccepChanges sets the RowState to Unchanged and the merge now knows what to do.

Job done!