Wednesday 19 August 2015

What are the differences between ExecuteReader ,ExecuteScalar and ExecuteNonQuery

ExecuteReader :
                                ExecuteReader is a method when we want to execute a select statement that returns values in the form of rows and columns. The method returns data in the form of a class DataReader. Which is modulled on DB Object table.


ExecuteScalar :
                             ExecuteScalar is also a method When we want to execute a select Statement that returns Single value. Where method  returns data in the form of an Object.


ExecuteNonQuery :
                            ExecuteNonQuery is also a method When we want to execute the DML Statements like Insert, Update and Delete. Where the method returns the no.of rows effected.

No comments:

Post a Comment