J
John J. Hughes II
Normally when I use the Adaptor update function and it work fine but
sometimes I get a "duplicate entry" error after the merge. I believe the
problem is because the primary key is modified and the merge function is
unable compensate for this event. I see three possible solutions to this
problem. One being not to let them update the key which is not an option.
Two being to determine if the key has changed and refilling the entire
dataset (any clue how?). Lastly determining why what I am doing is not
working. ;>
Any suggestions?
Should I be accepting the changes before the merge?
This is how I do it:
Open SQL;
DataSet tmpDS = oldDS.GetChanges();
if(tmpDS != null)
{
Adaptor.Update(tmpDS);
oldDS.Merge(tmpDS);
oldDS.AcceptChanges;
}
Close SQL;
Regards,
John
sometimes I get a "duplicate entry" error after the merge. I believe the
problem is because the primary key is modified and the merge function is
unable compensate for this event. I see three possible solutions to this
problem. One being not to let them update the key which is not an option.
Two being to determine if the key has changed and refilling the entire
dataset (any clue how?). Lastly determining why what I am doing is not
working. ;>
Any suggestions?
Should I be accepting the changes before the merge?
This is how I do it:
Open SQL;
DataSet tmpDS = oldDS.GetChanges();
if(tmpDS != null)
{
Adaptor.Update(tmpDS);
oldDS.Merge(tmpDS);
oldDS.AcceptChanges;
}
Close SQL;
Regards,
John