3
Reply

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

    If you want single value as a return from the database then you should use  sqlcommand.executescalar().

    17y
    0

    Execute Scalar is used to return a single value.

    sqlcommand.executescalar()