What are the methods provided by the command object?
The command objects used to connect the connection object to the Datareader or the dataset. The command object provided some methods which are as shown below :-
1)Execute Non Query :- It executes the command defined in the CommandText property against the connection defined in the Connection property for a query which does not return any row (an UPDATE, DELETE or INSERT). It returns an Integer showing the number of rows affected by the query.
2)ExecuteReader :- It executes the command defined in the Command Text property against the connection defined in the Connection property. It gives the "reader" object which is connected to the resulting rowset inside the database,& allowing the rows to be retrieved.
3)Execute Scalar :- It executes the command defined in the CommandText property against the connection defined in the Connection property. It Returns only the single value (effectively the Ist column of the Ist row of the resulting rowset) any other returned columns & rows are discarded. It is fast and efficient when only a "singleton" value is needed.