Chris Muench
Chris Muench

Reputation: 18328

ADO.NET tableadapter add/update/delete

I'm using the table adapter in C# where visual studio generates the code for you. I have inserts and updates working just fine using the following code.

However when trying to delete using the .update it gives me the following error.

Update requires a valid DeleteCommand when passed DataRow collection with deleted rows.

this.workersTableAdapter.Update(this.nursery_dbDataSet_workers.workers);

Upvotes: 1

Views: 2181

Answers (1)

Henk Holterman
Henk Holterman

Reputation: 273574

Open the DataSet designer and click on the Adapter. In the properties windows it has 4 Command properties, check the DeleteCommand. It seems to be missing.

You cam rerun the wizard or write the Delete Sql by hand.

Upvotes: 1

Related Questions