Good day! There was a following problem, during the work with SqlDataAdapter . I registered commands ( Delete , Insert , Update ) for the adapter and they work fine, BUT if I perform a specific search for a record in the table ( select*from... where... ), and I try to delete this record, then I get the following error:

The update element requires a valid deletecommand when transferring a DataRow collection with deleted rows.

Closed due to the fact that off-topic participants Denis Bubnov , aleksandr barakin , Alex , user194374, Grundy 9 December '16 at 9:09 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • "The question is caused by a problem that is no longer reproduced or typed . Although similar questions may be relevant on this site, solving this question is unlikely to help future visitors. You can usually avoid similar questions by writing and researching a minimum program to reproduce the problem before publishing the question. " - Denis Bubnov, aleksandr barakin, Alex, Community Spirit, Grundy
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • Adapter has four types of commands ( SelectCommand , InsertCommand , UpdateCommand and DeleteCommand ). In each of these parameters, a request or stored procedure is written. You do not have the text in DeleteCommand or UpdateCommand apparently. It would be necessary to bring their teams written. - Denis Bubnov
  • It's just very strange that it brings you this error. I met something similar, in my opinion, when I did not use the primary key in the team, I didn’t use the usual key attribute, but that was a long time ago. Therefore asked to bring the team in question. - Denis Bubnov
  • and where are these commands? In which method? - Denis Bubnov
  • Well, in principle, not scary, I would have rendered it at all in Window_Load , in order to avoid data rubbing. And about the error, it seems your DeleteCommand does not satisfy some conditions - Denis Bubnov
  • one
    If you have a new question, please ask it using the “ Ask a Question ” button in the upper right corner of the page. - aleksandr barakin Nov.

1 answer 1

Understood. The point is not at all about DeleteCommand and not at PK, the CLR just confused me with the data message. The fact was that in the handler of the "search" button, I redefined the existing adapter, but I had to create a new one. Which fills the same DataSet. Thank you Denis, that helped me figure it out.