32
Reply

What are the Methods of Commands in ADO.NET ?

Naitik  Jani

Naitik Jani

Apr 14, 2015
9.3k
0

    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.

    Mohan G
    April 19, 2015
    5

    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.

    ExexuteNonQueryExecuteScalerExecuteReader

    Anand Jee
    May 28, 2015
    1

    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.

    Alok Gupta
    May 27, 2015
    1

    ExexuteNonQueryExecuteScalerExecuteReader

    Rahul Prajapat
    May 26, 2015
    1

    ExexuteNonQueryExecuteScalerExecuteReader

    ExecuteNonQuery ExecuteScalar ExecuteReader

    Naitik Jani
    April 14, 2015
    1

    ExecuteReder,ExecuteNonQuery,ExecuteScaler

    VIKAS GUPTA
    October 21, 2017
    0

    ExecuteNonQuery ExecuteScalar, ExecuteReader

    Srikanth Reddy
    November 04, 2015
    0

    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

    Vamsi Krishna
    October 07, 2015
    0

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

    Srinivas Pabballa
    August 27, 2015
    0

    ExexuteNonQueryExecuteScalerExecuteReaderFill

    vinoth kumar
    August 18, 2015
    0

    ExexuteNonQueryExecuteScalerExecuteReaderFill

    vinoth kumar
    August 18, 2015
    0

    ExecuteNonQuery ExecuteReader ExecuteScalar Cancel Clone GetType

    Srikanth Reddy
    July 11, 2015
    0

    Methods of commands in ADO.NET ExecuteNonQuery ExecuteReader ExecuteScalar

    Yatendra Sharma
    June 23, 2015
    0

    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.

    Sujeet Suman
    June 18, 2015
    0

    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.

    Jaipal Reddy
    June 17, 2015
    0

    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.

    Munesh Sharma
    June 16, 2015
    0

    ExecuteNonQuery ExecuteScalar ExecuteReader

    MD SHAMSE ALAM
    June 13, 2015
    0

    ExecuteNonQuery() ExecuteScalar() ExecuteReader()

    bharat aggarwal
    June 03, 2015
    0

    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

    Neeraj Kumar
    June 02, 2015
    0

    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.

    Nanhe Siddique
    May 30, 2015
    0

    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.

    Vaibhav Salwe
    May 30, 2015
    0

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

    Mahendra
    May 26, 2015
    0

    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.

    sridhar thota
    May 24, 2015
    0

    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

    ExecuteNonQueryExecuteScalarExecuteReader

    kishorevemuri v
    May 05, 2015
    0

    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 .

    Rajkiran Swain
    April 28, 2015
    0

    ExecuteNonQuery ExecuteScalar ExecuteReader

    Rahul Kr
    April 27, 2015
    0

    -> ExecuteNonQuery-> ExecuteScalar-> ExecuteReader

    Nirav Vasoya
    April 21, 2015
    0

    ExecuteNonQuery ExecuteReader ExecuteScalar

    Anshul Gupta
    April 21, 2015
    0

    http://dotnet-munesh.blogspot.in/2013/12/adonet.html

    Munesh Sharma
    April 16, 2015
    0