Differents between ExecuteReader, ExecuteNonQuery, ExecuteScalar

Differents between ExecuteReader, ExecuteNonQuery AND ExecuteScalar


ExecuteReader : Use for accessing data. It provides a forward-only, read-only, connected record set.

ExecuteNonQuery : Use for data manipulation, such as Insert, Update, Delete.

ExecuteScalar : Use for retrieving 1 row 1 col. value.,

i.e. Single value.
eg: for retriving aggregate function.
It is faster than other ways of retrieving a single value from DB.

Differents between ExecuteReader, ExecuteNonQuery, ExecuteScalar Differents between ExecuteReader, ExecuteNonQuery, ExecuteScalar Reviewed by Bhaumik Patel on 8:00 PM Rating: 5