Monday, July 09, 2007

Difference between ExecuteReader,ExecuteScalar and ExecuteNonQuery

  • ExecuteReader: Use for accessing data, it provides a forward-only, read-only, connected recordset.
  • ExecuteScalar: Use for retriving Single value i.e 1 row 1 column value. Eg: for retriving aggregate function. Its faster than other ways fo retriving a single value from Database
  • ExecuteNonQurey: Use for data manipulation, such as Insert, update and delete

2 comments: