Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign

Tuesday, July 17, 2007 2:40:35 PM

Just a quick problem I ran across and a solution to it, so that I have a mental record of how I fixed this.

Working with a DataSet in .Net I needed to add a new column to the table.  The column was a Nullable VarChar(1000).  Using a little shortcut to get the column added to the dataset I added the column to the GetData command text which will cause the DataSet Visual Designer to create the column reference.

After battling with the wonderful "Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints." for a bout an hour I discovered that, while the SQL Column was set to Nullable, the DataSet disallowed Null values.  While I should have been more careful and verified the visual designers work, it still would have been nice to have it pick this up automatically.  That will teach me to use a shortcut.

Comments


Leave Comment

  

  

  




Are you human? Prove it!