Trapping error in DataAdapter.Fill(ds)

  • Thread starter Thread starter Rick
  • Start date Start date
R

Rick

I use a DataAdapter (.Net 1.1) to fill a dataset of about 30 tables
using a stored procedure. One of the tables is throwing a constraint
error, and I'd like to figure out which one. Can't debug through the
fill method so any suggestions on how to isolate and identify the
error?

Thanks,
Rick
 
Hi Rick,

Loop through tables in dataset and check DataTable.HasErrors property.
If you want to pinpoint the row, loop through rows in offending table and
check their HasErrors property.
 
Sure. Execute the SP via query analyzer.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Depending on the version of VS you're using, you might also be able to debug
the SP line-by-line.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Thanks - this was the kind of test I was looking for.
The problem is solved and turned out to be two tables in the dataset
being out of order with the select order in the stored procedure.
Interestingly, I re-created the error, looped through the tables and it
did find a table with the haserrors property set, but it was 5 tables
after the mismatch. The intervening tables had no rows selected and
the error property didn't get set until it tried to actually add rows
to a table.
At least it put me in the vicinity of the error.

Rick
 
Back
Top