Naitik  Jani
What are the Methods of Commands in ADO.NET ?
By Naitik Jani in ADO.NET on Apr 14 2015
  • Mohan  G
    Apr, 2015 19

    They are used to connect a Connection object to a DataReader or DataSet. Following are the methods provided by a Command object:ExecuteNonQuery: Executes the command defined in the CommandText property against the connection defined in the Connection property for a query that does not return any row (an UPDATE, DELETE, or INSERT). Returns an Integer indicating the number of rows affected by the query.ExecuteReader: Executes the command defined in the CommandText property against the connection defined in the Connection property. Returns a "reader" object that is connected to the resulting row set within the database, allowing the rows to be retrieved.ExecuteScalar: Executes the command defined in the CommandText property against the connection defined in the Connection property. Returns only a single value (effectively the first column of the first row of the resulting row set, any other returned columns and rows are discarded). It is fast and efficient when only a "singleton" value is required.

    • 6
  • Ravi Shekhar Vishwakarma
    May, 2015 20

    SQL Command Class having three types of methods in ADO.Net==>1) ExecuteNonQuery(); [Integer return type] return number of effected rows by DML Statement.2) ExecuteReader(); [SQl DataReader return type] Holds n-number of rows collection till the connection state is open. 3) ExecuteScaler(); [object return type] return a single cells value from the result of 'Select' statement.

    • 3
  • Anand Jee
    May, 2015 28

    ExexuteNonQueryExecuteScalerExecuteReader

    • 2
  • Alok Gupta
    May, 2015 27

    ExecuteNonQuery: This command method is used for other than select query. For inserting, updating and deleting.ExecuteScalar: This command method used to return single value of a first column record.ExecuteReader: This command method is used to read more than one records from a database.

    • 2
  • Rahul Prajapat
    May, 2015 26

    ExexuteNonQueryExecuteScalerExecuteReader

    • 2
  • sridhar thota
    May, 2015 24

    ExecuteNonQuery: This command method is used for other than select query. For inserting, updating and deleting.ExecuteScalar: This command method used to return single value of a first column record.ExecuteReader: This command method is used to read more than one records from a database.

    • 2
  • Pankaj  Kumar Choudhary
    May, 2015 14

    ExexuteNonQueryExecuteScalerExecuteReader

    • 2
  • Naitik  Jani
    Apr, 2015 14

    ExecuteNonQuery ExecuteScalar ExecuteReader

    • 2
  • VIKAS GUPTA
    Oct, 2017 21

    ExecuteReder,ExecuteNonQuery,ExecuteScaler

    • 1
  • Sreekanth Reddy
    Nov, 2015 4

    ExecuteNonQuery ExecuteScalar, ExecuteReader

    • 1
  • Vamsi Krishna
    Oct, 2015 7

    1)ExecuteNonQuery:-This method executes the command specifies and returns the number of rows affected 2)ExecuteScaler:-returns the first column of first row of the result set. 3) ExecuteReader:-return the set of rows

    • 1
  • Srinivas Pabballa
    Aug, 2015 27

    General methods of Command Class are ExecuteNonQuery(); ExecuteScalar(); ExecuteReader(); are the three main methods of Command class.

    • 1
  • vinoth kumar
    Aug, 2015 18

    ExexuteNonQueryExecuteScalerExecuteReaderFill

    • 1
  • vinoth kumar
    Aug, 2015 18

    ExexuteNonQueryExecuteScalerExecuteReaderFill

    • 1
  • Sreekanth Reddy
    Jul, 2015 11

    ExecuteNonQuery ExecuteReader ExecuteScalar Cancel Clone GetType

    • 1
  • Yatendra Sharma
    Jun, 2015 23

    Methods of commands in ADO.NET ExecuteNonQuery ExecuteReader ExecuteScalar

    • 1
  • Sujeet Suman
    Jun, 2015 18

    ExecuteNonQuery() : Doesn't return any data but returns affected row count. Return type is integer.ExecuteScalar Method(): It returns the value only in the first column of the first row. Return type is object. ExecuteReader(): It returns a DataReader object.ExecuteXMLReader(): It returns a XMLReader object.

    • 1
  • Jaipal Reddy
    Jun, 2015 17

    The following are the most commonly used methods of the SqlCommand class. ExecuteReader - Use when the T-SQL statement returns more than a single value. For example, if the query returns rows of data. ExecuteNonQuery - Use when you want to perform an Insert, Update or Delete operation ExecuteScalar - Use when the query returns a single(scalar) value. For example, queries that return the total number of rows in a table.

    • 1
  • Munesh Sharma
    Jun, 2015 16

    Execute Non Query :-Executes the command defined in the command text property against the connection defined in the connection property for a query that does not return any row (Insert, Update or Delete).Returns an integer indicating the number of rows affected by the query. Execute Reader :- Executes the command defined in the command text property against the connection defined in the connection property.Returns a reader object that in connected to the resulting row set within the data base, allowing the rows to be retrieved. Execute Scalar :-Executes the command defined in the command text property against the column defined in the connection property.Returns only single value the first column of the first row of the resulting row set any other returned columns and rows are discarded.

    • 1
  • MD SHAMSE ALAM
    Jun, 2015 13

    ExecuteNonQuery ExecuteScalar ExecuteReader

    • 1
  • bharat aggarwal
    Jun, 2015 3

    ExecuteNonQuery() ExecuteScalar() ExecuteReader()

    • 1
  • Neeraj Kumar
    Jun, 2015 2

    1.ExecuteNonQuery: This method executes the command specifies and returns the number of rows affected. 2.ExecuteReader: The ExecuteReader method executes the command specified and returns an instance of instance of SqlDataReader class. 3.ExecuteScalar: This method executes the command specified and returns the first column of first row of the result set. The remaining rows and column are ignored. 4.ExecuteXMLReader: This method executes the command specified and returns an instance of XmlReader class. This method can be used to return the result set in the form of an XML document

    • 1
  • Nanhe Siddique
    May, 2015 30

    ExecuteReader : Returns a DataReader object. ExecuteScalar : Returns a single scalar value. ExecuteNonQuery : Executes a command that does not return any rows. ExecuteXMLReader : Returns an XmlReader. Available for a SqlCommand object only.

    • 1
  • Vaibhav Salwe
    May, 2015 30

    Hello Naitik,As per as Command object is concern i come up with Important properties and method listed below.Properies : 1) CommandText2) CommandType3) CommandTimeout4) Connection.5) DbConnection. Methods : 1) ExecuteNonQuery.2) ExecuteScalar.3) ExecuteReaderFor more information go to visual studio whatever version you have and take a reference of System.Data.SqlClient and create a object of SqlCommand object right client on class and select "Go to defination" or press F12 then you will find everything.

    • 1
  • Mahendra
    May, 2015 26

    ExecuteNonQuery : Insert ,Update and DeleteExecuteScalar : Select (For Single Value return)ExecuteReader :Select

    • 1
  • Ravi Shekhar Vishwakarma
    May, 2015 20

    SQL Command Class having three methods in ADO.Net i.e.1)ExecuteNonQuery() [Integer return type] on DML Statement 2)ExecuteScaler() [Object return type] Use Select Command 3)ExecuteReader() [SQL Data Reader return type] Holdes n-number of rows collection till the connection satae is open

    • 1
  • kishorevemuri v
    May, 2015 5

    ExecuteNonQueryExecuteScalarExecuteReader

    • 1
  • Rajkiran Swain
    Apr, 2015 28

    The Command Object in ADO.NET executes SQL statements and Stored Procedures against the data source specified in the C# Connection Object. The Command Object requires an instance of a C# Connection Object for executing the SQL statements .In order to retrieve a resultset or execute an SQL statement against a Data Source , first you have to create a Connection Object and open a connection to the Data Source specified in the connection string. Next step is to assign the open connection to the connection property of the Command Object . Then the Command Object can execute the SQL statements. After the execution of the SQl statement, the Command Object will return a result set . We can retrieve the result set using a Data Reader .

    • 1
  • Rahul Kr
    Apr, 2015 27

    ExecuteNonQuery ExecuteScalar ExecuteReader

    • 1
  • Nirav Vasoya
    Apr, 2015 21

    -> ExecuteNonQuery-> ExecuteScalar-> ExecuteReader

    • 1
  • Anshul Gupta
    Apr, 2015 21

    ExecuteNonQuery ExecuteReader ExecuteScalar

    • 1

Most Popular Job Functions


MOST LIKED QUESTIONS