20 November 2013

Difference between ExecuteNonQuery,ExecuteReader and ExecuteScalar..?

Difference between ExecuteNonQuery,ExecuteReader and ExecuteScalar..?

These three are OLEDB command class methods.Now we will see what is main difference between them.

1.ExcuteNonQuery:
This method is required to execute DDL,DML,TCL and stored procedure

2.Execute Reader:
a)This method required to execute select statement
b)This is required while expecting multiple records
c)Execute Reader() returns the records in the format of Data Reader

3.Execute Scalar:
a)This is also required To execute select statement
b)required which expecting a Particular record
c)Execute scalar() returns object
d)Execute Scalar() checks for first match only,If the match is found ,then on first column value of the first record will returned

No comments:

Post a Comment