If i am expecting a single result from sqlserverdatabase
then what command should i follow ?sqlcommand.executereader
(commandbehaviour.singleresult)or sqlcommand.executescalar()

Answer Posted / m.mohan krishna

Sqlcommand.executescalar() is preffered.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between connected and disconnected architecture in ado.net?

686


What is the meaning of executenonquery?

613


What are the objects of ado.net?

631


What is oledb connection?

591


Describe connection object in ado.net

633






Define connection string?

671


How can we check that some changes have been made to dataset since it was loaded?

617


What is the advantage of ado.net?

641


What is the difference between SqlCommand and SqlCommandBuilder?

678


What are disadvantages of microsoft-provided data provider classes in ado.net?

603


What is the hierarchy of data in databases?

585


What is the role of clr?

621


Explain what are the steps to connect to a database?

592


Explain how to bind the controls(best practice) comboboxes to the data in the dataset?

638


Which one of the following objects is a high-level abstraction of the connection and command objects in ado.net?

672