M
Matt Young
What I want to do is catch and dismiss expected errors during an update
(resolve the problem and allow the update to continue) but have unexpected
errors throw their exception normally (stopping the update). To accomplish
this, I created a method and attached it to the SqlDataAdapter.RowUpdated
event. It looks similar to this,
private void errorHandler(object sender, SqlRowUpdatedEventArgs args)
{
if(args.Status != UpdateStatus.ErrorsOccurred)
{
return;
}
// determine if the error should be ignored
if(ignoreError)
{
// error should be ignored
args.Status = UpdateStatus.Continue;
args.Errors = null;
}
}
With this code in place, errors I've ignored still throw an exception and
halt the update. This behavior leads me to the conclusion that changing
properties on the SqlRowUpdatedEventArgs object in my method have no lasting
effect. Should this be so?
Can someone please tell me if I have a logical or conceptual flaw here?
Thanks!
Matt
P.S. This is running on the CompactFramework
(resolve the problem and allow the update to continue) but have unexpected
errors throw their exception normally (stopping the update). To accomplish
this, I created a method and attached it to the SqlDataAdapter.RowUpdated
event. It looks similar to this,
private void errorHandler(object sender, SqlRowUpdatedEventArgs args)
{
if(args.Status != UpdateStatus.ErrorsOccurred)
{
return;
}
// determine if the error should be ignored
if(ignoreError)
{
// error should be ignored
args.Status = UpdateStatus.Continue;
args.Errors = null;
}
}
With this code in place, errors I've ignored still throw an exception and
halt the update. This behavior leads me to the conclusion that changing
properties on the SqlRowUpdatedEventArgs object in my method have no lasting
effect. Should this be so?
Can someone please tell me if I have a logical or conceptual flaw here?
Thanks!
Matt
P.S. This is running on the CompactFramework