Ismail Baig
What is the Difference between ExecuteNonQuery, ExecuteReder, ExecuteScalar?
By Ismail Baig in .NET on Jan 10 2017
  • Amit Swami
    Oct, 2017 14

    execute non query return a int , while execute scalar return a value of table cell , and execute reader return two or more cells of table

    • 0
  • Thennarasu N
    Mar, 2017 17

    ExecuteScalar() only returns the value from the first column of the first row of your query. ExecuteReader() returns an object that can iterate over the entire result set. ExecuteNonQuery() does not return data at all: only the number of rows affected by an insert, update, or delete.

    • 0
  • Thennarasu N
    Mar, 2017 17

    ExecuteScalar() only returns the value from the first column of the first row of your query. ExecuteReader() returns an object that can iterate over the entire result set. ExecuteNonQuery() does not return data at all: only the number of rows affected by an insert, update, or delete.

    • 0
  • Thennarasu N
    Mar, 2017 17

    ExecuteScalar() only returns the value from the first column of the first row of your query. ExecuteReader() returns an object that can iterate over the entire result set. ExecuteNonQuery() does not return data at all: only the number of rows affected by an insert, update, or delete.

    • 0
  • Ismail Baig
    Jan, 2017 10

    ExecuteNonQuery(): 1. will work with Action Queries only (Create,Alter,Drop,Insert,Update,Delete). 2. Returns the count of rows effected by the Query. 3. Return type is int 4. Return value is optional and can be assigned to an integer variable. ExecuteReader(): 1. will work with Action and Non-Action Queries (Select) 2. Returns the collection of rows selected by the Query. 3. Return type is DataReader. 4. Return value is compulsory and should be assigned to an another object DataReader. ExecuteScalar(): 1. will work with Non-Action Queries that contain aggregate functions. 2. Return the first row and first column value of the query result. 3. Return type is object. 4. Return value is compulsory and should be assigned to a variable of required type.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS