Which myCommand method should you use?

Your Microsoft SQL Server database has a stored procedure that sums the total number of orders received each day. The stored procedure returns a result that is a single data value of type integer. You need to write code that will execute the stored procedure and return the result as an integer value. You instantiate a SqlCommand object named myCommand and initialize all appropriate parameters. Which myCommand method should you use?

Your Microsoft SQL Server database has a stored procedure that sums the total number of orders received each day. The stored procedure returns a result that is a single data value of type integer. You need to write code that will execute the stored procedure and return the result as an integer value. You instantiate a SqlCommand object named myCommand and initialize all appropriate parameters. Which myCommand method should you use?

A.
ExecuteReader

B.
ExecuteNonQuery

C.
ExecuteScalar

D.
ExecuteXMLReader



Leave a Reply 0

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