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 ado.net full form?
What property must be set and what method must be called in your code to bind the data from some data source to the Repeater control?
What is a string variable?
What are different layers of ADO.Net?
How to load multiple tables into a dataset?
What does ado stand for in ado.net?
What is fill method in ado.net?
List all the steps in order, to access a database through ado.net?
What are the advantages of oledb compared with other classes?
How can we perform transactions in .net?
What is csdl entity framework?
What is an example of ordinal data?
Can you explain how to enable and disable connection pooling?
Explain the overview of ado.net architecture?
How to bind the controls(best practice) comboboxes to the data in the dataset?