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

Answer Posted / vinay

Both of these are same commandbehaviour.singleresult also
give you a single result. but we should use
sqlcommand.executescalar()

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of sqldatareader class?

554


How to work with disconnected data - the dataset and sqldataadapter?

593


What is commandbuilder in ado.net?

602


How can I retrieve two tables of data at a time by using data reader? Data reader read and forward only, how is it possible to get 2 tables of data at a time?

596


What are the parameters that control most of connection pooling behaviours?

674






What are the major challenges in accessing data from a database?

614


What is the difference between sqldatareader and sqldataadapter?

568


Which is faster dataset or datareader?

630


I loaded the dataset with a table of 10 records. One of the records is deleted from the backend, how do you check whether all the 10 records were present while updating the data(which event and steps) and throw the exception 28 can datareader hold data from multiple tables?

643


How will you fill the gridview by using datatable object at runtime?

632


What are the differences between OLEDB and SQLClient Providers?

649


How is it possible to get 2 tables of data at a time by using data reader?

572


What is difference between executenonquery and executequery?

556


Why do we serialize data?

594


What is sqldatareader?

572