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

How do you update a dataset in ado.net?

1 Answers  


What is ado control?

1 Answers  


Is ado.net dead?

1 Answers  


What are the important features of ado.net 2.0?

1 Answers  


What is ole used for?

1 Answers  


What is connection string?

1 Answers  


What is the difference between sqlcommand and sqldataadapter?

1 Answers  


Sequence to connect and retrieve data from database useig dataset ?

6 Answers   MMTS,


Define the executescalar method?

1 Answers  


What are the methods of XML dataset object?

1 Answers  


How can you add or remove rows from the datatable object of dataset?

1 Answers  


What is a column variable?

1 Answers  


Categories