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 a dataset?
How is entity framework different from ado.net?
What is the significance of CommandBehavior.CloseConnection ?
Define executenonquery?
What is the role of data provider in ado.net?
What does executequery return?
What is datasource in ado.net?
What is ado.net in vb net?
What we do with the object of ado.net dataset after using it?
Do we use stored procedure in ADO.Net?
What is execute reader in ado.net?
Does executenonquery return a value?
Which namespaces are used for data access?
Explain the difference in record set and dataset?
What is ado asp?