Interviews31 answers
What are the Methods of Commands in ADO.NET ?
31 Answers
ExecuteReder,ExecuteNonQuery,ExecuteScaler
VIKAS GUPTAPosted Oct 21, 2017, 1:15 PM EDT
ExecuteNonQuery
ExecuteScalar,
ExecuteReader
Sreekanth ReddyPosted Nov 4, 2015, 1:35 AM EST
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 KrishnaPosted Oct 7, 2015, 4:57 AM EDT
General methods of Command Class are
ExecuteNonQuery();
ExecuteScalar();
ExecuteReader();
are the three main methods of Command class.
Srinivas PabballaPosted Aug 27, 2015, 5:18 AM EDT
ExexuteNonQuery
ExecuteScaler
ExecuteReader
Fill
vinoth kumarPosted Aug 17, 2015, 11:29 PM EDT
ExexuteNonQuery
ExecuteScaler
ExecuteReader
Fill
vinoth kumarPosted Aug 17, 2015, 11:29 PM EDT
ExecuteNonQuery
ExecuteReader
ExecuteScalar
Cancel
Clone
GetType
Sreekanth ReddyPosted Jul 10, 2015, 10:26 PM EDT
Methods of commands in ADO.NET
ExecuteNonQuery
ExecuteReader
ExecuteScalar
Yatendra SharmaPosted Jun 23, 2015, 4:08 AM EDT
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 SumanPosted Jun 17, 2015, 11:42 PM EDT
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 ReddyPosted Jun 17, 2015, 4:21 AM EDT
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 SharmaPosted Jun 15, 2015, 8:35 PM EDT
ExecuteNonQuery
ExecuteScalar
ExecuteReader
MD SHAMSE ALAMPosted Jun 13, 2015, 9:28 AM EDT
ExecuteNonQuery()
ExecuteScalar()
ExecuteReader()
bharat aggarwalPosted Jun 3, 2015, 3:07 AM EDT
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 KumarPosted Jun 2, 2015, 11:37 AM EDT
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 SiddiquePosted May 30, 2015, 3:02 AM EDT
Hello Naitik,
As per as Command object is concern i come up with Important properties and method listed below.
Properies :
1) CommandText
2) CommandType
3) CommandTimeout
4) Connection.
5) DbConnection.
Methods :
1) ExecuteNonQuery.
2) ExecuteScalar.
3) ExecuteReader
For 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 SalwePosted May 30, 2015, 2:42 AM EDT
ExexuteNonQuery
ExecuteScaler
ExecuteReader
Anand JeePosted May 28, 2015, 2:59 PM EDT
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 GuptaPosted May 27, 2015, 12:09 AM EDT
ExexuteNonQuery
ExecuteScaler
ExecuteReader
Rahul PrajapatPosted May 25, 2015, 10:26 PM EDT
ExecuteNonQuery : Insert ,Update and Delete
ExecuteScalar : Select (For Single Value return)
ExecuteReader :Select
MahendraPosted May 25, 2015, 9:14 PM EDT
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 thotaPosted May 24, 2015, 9:07 AM EDT
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.
Ravi Shekhar VishwakarmaPosted May 20, 2015, 11:51 AM EDT
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
Ravi Shekhar VishwakarmaPosted May 20, 2015, 11:35 AM EDT
ExexuteNonQuery
ExecuteScaler
ExecuteReader
Pankaj Kumar ChoudharyPosted May 13, 2015, 8:17 PM EDT
ExecuteNonQuery
ExecuteScalar
ExecuteReader
kishorevemuri vPosted May 5, 2015, 1:37 AM EDT
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 SwainPosted Apr 28, 2015, 7:10 AM EDT
ExecuteNonQuery
ExecuteScalar
ExecuteReader
Rahul KrPosted Apr 27, 2015, 1:39 AM EDT
-> ExecuteNonQuery
-> ExecuteScalar
-> ExecuteReader
Nirav VasoyaPosted Apr 21, 2015, 3:31 AM EDT
ExecuteNonQuery
ExecuteReader
ExecuteScalar
Anshul GuptaPosted Apr 21, 2015, 12:26 AM EDT
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 GPosted Apr 19, 2015, 6:48 PM EDT
ExecuteNonQuery
ExecuteScalar
ExecuteReader
Naitik JaniPosted Apr 14, 2015, 3:41 AM EDT





















