"If at first you don't succeed; call it version 1.0" :-Unknown

Pages

Monday, September 20, 2010

Difference between ExecuteReader,ExecuteNonQuery and ExecuteScalar.

Hi frienz,
i got a bit for ur nxt interview :). here i giving the keyhole difference b/w ExecuteReader,ExecuteNonQuery and ExecuteScalar.

* ExecuteReader : Use for accessing data. It provides a forwardonly,
read-only, connected recordset.

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

* ExecuteScalar : Use for retriving 1 row 1 col. value., i.e.
Single value. eg: for retriving aggregate function. It is faster
than other ways of retriving a single value from DB.

Hope it help u someways...
Have a nice day... 'N happy Coding :)

No comments: