DataAdapter.FillError event does not fire

G

Guest

I have a strongly typed dataset which I want to fill with data. If the data
has errors (e.g. duplicate primary keys) I want to receive a
DataAdapter.FillError event.

However, this event does not fire. I both tried
myDataAdapter.ContinueUpdateOnError = False and
myDataAdapter.ContinueUpdateOnError = True but to no avail.

BTW, the myDataAdapter.Fill(myTableName) method does not fire the FillError
event but it does throw an exception "Failed to enable constraints. One or
more rows contain values violating non-null, unique, or foreign-key
constraints."

Any ideas how to activate the FillError event?

Thanks,
Guido
 
W

WenYuan Wang

Hi Gudo,

According to your description, I understand that the FillError event
doesn't fire when there is a constraint Exception. Please don't hesitate to
correct me if I misunderstand anything here.

As far as I know, DataAdapter.ContinueUpdateOnError property is used for
Update method. It doesn't affact FillError event.

The FillError event only happens when a recoverable error occurs and will
only catch exceptions from the datareader GetValues, Read, NextResults. I'm
afraid the Constraint Exception can't be caught. I have checked bug list
and found this is a bug.

Thanks for your understanding.
Best Regards,
Wen Yuan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top