Friday, December 3, 2010

ASP.NET Datasets: Failed to enable constraints.

Got this error after changing the length of a column in the database:
Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

CAUSE:
The table adapter column maxlength is not updated automatically.

SOLUTION:
Update the table adapter column maxlength manually in the properties window for that column in the dataset editor.

Source:
http://social.msdn.microsoft.com/Forums/en/Vsexpressvb/thread/27aec612-5ca4-41ba-80d6-0204893fdcd1