How do I update constraints in a dataset
Posted on 2009-07-15
Hello, here is a question that is bugging me. There has got to be a good solution for it, but I couldn't find it. I am using Vb.Net in Visual Studio 2005 accessing data from Sql Server 2005.
Here is what I did that caused a problem:
1. I created a database in Sql Server 2005 with constraints
2. I created a dataset in Visual Studio
3. In Sql Server I changed the field definition, deleted the constraint, changed the data, and created a new constraint that was incompatible with the old one.
4. Now I tried to fill the dataset in Visual Studio, but it produced an error: "Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints." It appears that the dataset has a copy of the old constraint.
My question is this: How can I update the dataset with the new constraint without deleting the dataset and starting over? It doesn't matter to me whether I do it manually somehow or do it via code; it only needs to be done once.
Thanks for your consideration