They are used to connect object to Datareader or dataset .Following are the methods provided by command object :-
1. EcecuteNonQuery :- 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 value indicating the number of rows affected by the query.
2. ExecuteReader :- Executes the command which is defined in the CommandText property against the connection defined in the Connection property. Returns a "reader" object which is connected to the resulting rowset within the database, allowing the rows to be retrieved.
3. ExecuteScalar :- Executes the command which is 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 rowset) any other returned columns and rows are discarded. It is fast and efficient when only a single value is required.
1. EcecuteNonQuery :- 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 value indicating the number of rows affected by the query.
2. ExecuteReader :- Executes the command which is defined in the CommandText property against the connection defined in the Connection property. Returns a "reader" object which is connected to the resulting rowset within the database, allowing the rows to be retrieved.
3. ExecuteScalar :- Executes the command which is 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 rowset) any other returned columns and rows are discarded. It is fast and efficient when only a single value is required.