2
Reply

What is the difference b/w ExecuteReader, ExecuteScalar & ExecuteNonQuery. And what they return.

17y
10.9k
0
Reply

    Executereader  :-is used with read  Method and it will read the query and fill that in a dataset.we  use it in  datareader.

    Execute Scalar:-is used when you want a single output.It is used with Return Value.

    ExecuteNonQuery:-This Function is Used When you want to update your query it does not perform any aoperation like:-update,deletion,insert.It is used with Perform Action.

    ExcecuteReader : this method should be used when you want to execute a row returning commant, such as SELECT statement.

    ExecuteScaler : you should use this method when you only want the first column of the first row of the result set runtime.

    ExecuteNonQuery : use this method when you want to execute non row returning command such as DELETE statement.