Muhammad Imran Ansari
What is performance impact of ExecuteScaler, ExecuteNonQuery and ExecuteDataReader?

Working with ExecuteScaler, ExecuteNonQuery and ExecuteDataReader, What is performance impact.

By Muhammad Imran Ansari in .NET on Mar 10 2022
  • Brahma Prakash Shukla
    Nov, 2022 9

    ExecuteNonQuery():

    will work with Action Queries only (Create,Alter,Drop,Insert,Update,Delete).
    Returns the count of rows effected by the Query.
    Return type is int
    Return value is optional and can be assigned to an integer variable.

    ExecuteReader():

    will work with Action and Non-Action Queries (Select)
    Returns the collection of rows selected by the Query.
    Return type is DataReader.
    Return value is compulsory and should be assigned to an another object DataReader.

    ExecuteScalar():

    will work with Non-Action Queries that contain aggregate functions.
    Return the first row and first column value of the query result.
    Return type is object.
    Return value is compulsory and should be assigned to a variable of required type.

    • 1


Most Popular Job Functions


MOST LIKED QUESTIONS