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 are the advantages and drawbacks of using ado.net?
What is connection in ado.net?
What is the difference in record set and dataset?
What are the different row versions available in table?
How do you merge 2 datasets into the third dataset in a simple manner?
Which database is the ado.net?
What is ado.net and its architecture?
how to create a quiz software using 4 options to answer and how to check with answers in the database and award marks....
Explain the various objects in dataset.
what is the difference betwen typed dataset and untyped dataset?in general which dataset can we use in programming?
If a table contains 20000 records . In a page at each time 100 records to be displayed what are the steps you will take to improve performance? Will you use dataset or datareader?
What are the advantage of ado.net?
List all the steps in order, to access a database through ado.net?
What is the difference between ado.net and entity framework?
What is connection string?