Update requires a valid DeleteCommand when passed DataRow collection with deleted rows
While trying to delete the data from my SQL Server CE 3.5 database, I am getting error:
Update requires a valid DeleteCommand when passed DataRow collection with deleted rows"
While it is ok with Access dat开发者_C百科abase.
Please advise. Thanks!
That how I fixed it:
- In my SQL set Primary Key
- In SQL Server Object Explorer find your table, ensure same column has set a primary key
- In Solution Explorer, right click your DataSet, View Designer, ensure your table same column set a primary key
- save all, must ensure all are saved!
- rebuild, done.
I browsed through several forums and found that we need to follow following to get rid of this error:
1) Add a field in database, say PK,
2) Data Type Bigint, then set Primary Key property to Yes
In the lower grid you will see Identity filed getting enabled. By default it is False.
3) Make it True.
4) IdentityIncrement and IdentitySeed should contain the value 1
The error shall be resolved.
精彩评论