Which method is used to execute a non-query command and retrieve the number of rows affected?

  • ExecuteNonQuery()
  • ExecuteReader()
  • ExecuteScalar()
  • ExecuteXmlReader()
The ExecuteNonQuery() method is used to execute a non-query SQL statement against a database. It returns the number of rows affected by the command. This method is commonly used with INSERT, UPDATE, DELETE, and other SQL commands that do not return data. By utilizing ExecuteNonQuery(), developers can perform data manipulation operations and obtain feedback on the success or failure of their commands by examining the number of rows affected, facilitating efficient database interaction in ADO.NET.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *