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

Answers were Sorted based on User's Feedback



If i am expecting a single result from sqlserverdatabase then what command should i follow ?sqlcom..

Answer / pankul

sqlcommand.executescalar()

Is This Answer Correct ?    9 Yes 0 No

If i am expecting a single result from sqlserverdatabase then what command should i follow ?sqlcom..

Answer / m.mohan krishna

Sqlcommand.executescalar() is preffered.

Is This Answer Correct ?    2 Yes 0 No

If i am expecting a single result from sqlserverdatabase then what command should i follow ?sqlcom..

Answer / 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

If i am expecting a single result from sqlserverdatabase then what command should i follow ?sqlcom..

Answer / raji

single result

Is This Answer Correct ?    0 Yes 5 No

Post New Answer

More ADO.NET Interview Questions

What is difference between sqldatareader and sqldataadapter?

0 Answers  


What is the difference between Response.Expires and Reponse.ExpiresAbsolute?

0 Answers  


Explain the dataadapter class in ado.net?

0 Answers  


suppose we using gridview contrl,with sqldatasource.in that for birth date how can we take validation contrl for dd/mm/yy formator how we assign regular expression for same

9 Answers   TCS,


What is defaultview in datatable?

0 Answers  






what are the differences between dataset and datareader?

4 Answers   Choice Solutions,


What is an orm, and why would you use one instead of plain old ado.net?

0 Answers  


How can I retrieve two tables of data at a time by using data reader?

0 Answers  


What is dbcontext and dbset in entity framework?

0 Answers  


How to identify the updated rows in a dataset?

0 Answers  


what is trigger?

8 Answers   Microsoft, Precept Technology,


Where do you store connection string ?

3 Answers   Digital GlobalSoft,


Categories