DataTable ConstraintException problem/debugging VB - VS 2005

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I am loading a Typed Dataset using another dataset via each table's Load() Method and getting a ConstraintException on one of the tables.

Disabling the constraints before the load and Enabling constraints after the load produces the same error.

Leaving the constraints disabled should not be an option. I want to know what is blowing the constraint.

I am loading the data using this method because I want one trip to the database to return multiple resultsets/tables via a stored proc, and I have to use our existing data access layer which does not expose a DataAdapter, just a dataset via method call. I have to use the Load method and pass an DataReader from CreateReader.

Is there ANY way to figure out which of the columns/rows are causeing the ConstraintException ? (Eyeballing rows in the DataTable Visualizer does not count ;) )

1) I have tried trapping in a delegate for FillErrorEventHandler passed to the Load method on the DataTable. This does no good because it seems the constraints are not enforced until after the entire table is loaded with data.

2) I have tried handling the RowChanging Event and looking there, but it is no good becuase of the same reason as statement #1.

3) try/catch does no good because the error message is not verbose. It just says that there was a ConstraintException.

I have tried eyeballing each column's constraints in the Properties window while in the DataSet Designer and the datatable rows thru the visualizer to no avail. Everything 'looks' good (40 rows to search, so might miss something).

I removed any primary keys on the datatable. Still get the error.

Is there any way to list the contraints on a table?

-Brice




EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com
.



Relevant Pages

  • Re: ANN: Query A Dataset Beta Download
    ... >>> disable constraints during load times. ... >> rollback). ... >> rollback is to toss the database out the window:)). ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Statistics during a complex load
    ... drop all constraints (eg. foreign keys) and indexes ... before the load, and, if necessary, create them afterwards. ... As for partitioning - look at interval partitions ... As for the previous reply to drop constraints etc, ...
    (comp.databases.oracle.server)
  • Re: How to disable foreign key constraints in a stored procedure?
    ... constraints, perform some actions, and then re-enable them. ... My suggestion would be to re-think your 'reasoning' for disabling the ... Suppose you want to bulk load data into database - the data is coming ... Could you guarantee no other connected user ...
    (comp.databases.oracle.server)
  • Re: How to disable foreign key constraints in a stored procedure?
    ... constaints there) and you want the quickest load time (perhaps this is a ... constraints in place. ... Disable the constraints before the bulk load ...
    (comp.databases.oracle.server)
  • Re: OK, its the matter of database structure rather
    ... handle any possible, albeit unlikely, load of data, aside from the ... extra mental effort required to think things all the way through. ... constraints in maintenance. ... There is no such thing as "all the way through" in real life ...
    (comp.lang.tcl)