what is execute scalar?
Answer Posted / yograj pandey
Use the ExecuteScalar method to retrieve a single value (for example, an aggregate value) from a database. This requires less code than using the ExecuteReader method, and then performing the operations that you need to generate the single value using the data returned by a SqlDataReader.
A typical ExecuteScalar query can be formatted as in the following C# example:
cmd.CommandText = "SELECT COUNT(*) FROM dbo.region";
Int32 count = (Int32) cmd.ExecuteScalar();
| Is This Answer Correct ? | 6 Yes | 1 No |
Post New Answer View All Answers
What is sqldatareader in ado.net?
What is oledb connection?
What is Dataset Object?
Which is faster dataset or datareader?
Explain how to call the sql commands asynchronously in ado.net version 2.0?
How do you update a dataset in ado.net and how do you update database through dataset?
Explain how to find the given query is optimised one or not?
What is data view and variable view?
What are the Features and disadvantages of dataset
Explain the basic use of "dataview" and explain its methods.
What is the meaning of object pooling?
how to create a quiz software using 4 options to answer and how to check with answers in the database and award marks....
What does ole stand for in excel?
What is typed dataset ?
Define ado.net?