Select from following answers:- Write adhoc query and call the SqlCommand.ExecuteScalar() method
- Writing stored procedure in the SqlDataAdapter constructor
- Writing stored procedure and call the SqlCommand.ExecuteScalar() method

- none of these
- All Above
3 is correct. For retreiving the aggregate results, creating a stored procedure and calling the ExecuteScalar method is the fastest way.
1 is wrong as using an adhoc query is slower than
using a stored procedure
2 is wrong as we will have to use DataTable/DataSet
that might create memory overhead.
Show Correct Answer
Asked In: Many Interviews |
Alert Moderator