Why is EndExecuteNonQuery () required?

The documentation here states that

developers need the EndExecuteNonQuery method to complete the operation.

I could not find a good reason why this is so, or what results do not cause EndExecuteNonQuery.

Any understanding of what will happen if it is not triggered? I don't want to block it, is there a way to automatically call it in AsyncCallback?

+3
source share
2 answers

This will do things like:

  • update parameter values โ€‹โ€‹(exit / return)
  • check exceptions (error codes in the TDS stream - restriction of restrictions, etc.)
  • /, ..

, :

+4

, , . , EndExecutexxx.

, EndExecuteNonQuery:

 SqlDataReader reader = this.CompleteAsyncExecuteReader();
 if (reader != null)
 {
      reader.Close();
 }
+1

Source: https://habr.com/ru/post/1774415/


All Articles