DataSet Constraint Error

I was dealing with an error about "Failing to enable constraints".  I was just added to this project and I couldn't figure out how to determine exactly where the problem is.  In reading this article:

http://weblogs.asp.net/rosherove/archive/2004/10/03/DataSet-hell-_2D00_-_2200_Failed-to-enable-constraints.-One-or-more-rows--contain-values_2E002E002E002E002200_.aspx

I used this approach to create a custom class that generates a more detailed error message, by using the DataTable.GetErrors() and the DataRow.GetColumnsInError() methods.  This was very handy to identify the rows that were the problem (I even added the primary key to the message, which really helped to determine that there were duplicate keys, and some null fields).

Comments

No Comments

The leading UI suite for ASP.NET - Telerik radControls
Outstanding performance. Full ASP.NET AJAX support. Nearly codeless development.