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
How can we load multiple tables in to dataset?
How to perform sorting on a table in ADO.NET?
Explain how can we load multiple tables in to dataset?
What are the different ado.net namespaces are available in .net?
What is connection in ado.net?
What is the difference between linq and ado.net?
How to create dynamic gridview?
What is a serialized object?
What is XML serialization
What is basic use of data view?
How to copy the contents from one table to another table and how to delete the source table in ado.net?
Define connection string?
What are dataproviders?
What does ado stand for?
How to maintain the relation between two tables in ADO.NET?