dataSet Fill problems
Posted: Sun 30 Oct 2011 12:37
Hello,
Assume I have Table "Category" with two columns "CategoryID" and "CategoryName" and I want to add new row and then update dataSet.
At the beginning I have 2 rows:
CategoryID CategoryName
"1" "first"
"2" "second"
Before inserting I invoke Fill method to update dataSet with information:
uniCategoryTableAdapter.Fill(dataSet, "Category");
(it works, fill out dataSet whole Category table)
then I insert third row:
string insertString = @"
INSERT INTO Category
(CategoryID, CategoryName)
VALUES ('3', 'third')";
then trying to fill the dataSet and I get exception:
Duplicate entry "3" for key "PRIMARY"..
Any ideas how to solve the problem?
Assume I have Table "Category" with two columns "CategoryID" and "CategoryName" and I want to add new row and then update dataSet.
At the beginning I have 2 rows:
CategoryID CategoryName
"1" "first"
"2" "second"
Before inserting I invoke Fill method to update dataSet with information:
uniCategoryTableAdapter.Fill(dataSet, "Category");
(it works, fill out dataSet whole Category table)
then I insert third row:
string insertString = @"
INSERT INTO Category
(CategoryID, CategoryName)
VALUES ('3', 'third')";
then trying to fill the dataSet and I get exception:
Duplicate entry "3" for key "PRIMARY"..
Any ideas how to solve the problem?