You want to retrieve a single value (e.g., the total number of records) from a SELECT statement. Which ADO.NET method would you use for this purpose?

  • ExecuteScalar
  • ExecuteNonQuery
  • ExecuteReader
  • ExecuteXmlReader
The correct option is ExecuteScalar. This method is used to execute a query that returns a single value, such as a count, sum, or average. It is commonly used when you need to retrieve aggregate information from the database without fetching a full result set.
Add your answer
Loading...

Leave a comment

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