development blog for the wicked stuff we encounter

Visual Studio 2008 keeps me entertained all day long:) I have a really complicated project, with several tables and views and stored procedures hooked upon it. I'm using XSD as an intermediate abstraction layer. The error message "Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints" kept haunting me for days; I double checked anything:
  • there were no duplicate keys whatsoever
  • there were no NULL values, I experienced with IsNull(..) for fields
  • even empty tables had this error.
Finally, I figured out, that and any changes to the database schema, even the change of the length of any column triggers the above error, the XSD Schema simply does not recieve the changes; even when I click Refresh Schema. The one and only working solution is to open the given XSD file, and simply delete and re-add the errorous object.

I recently found a way to do a distinct operation on the DataTable class in dotnet 2.0: DataTable products = GetProductList(); DataView dv = new DataView(products); products = dv.ToTable("products", true, new string[] {"ArticleId","ArticleName","Description"}); And the products DataTable will be a distinct list of all products (in this case, one product can belong to two categories as well - so there are duplicate items with different price, attributes etc.).