What is the use of command Object?
Rahul Pandey
Command object is used to initialize database commands.SqlCommand cmd = new SqlCommand("select * from employee",conn); here we are passting a sqlcommand as s string and also a connection object as parameter to the SqlCommand instance constructor. and those are gets initialized in the instance constructor. when we call the other merthods of commad class such as ExecuteReader() ExecuteScalar() and ExecuteNonQuery() methods will execute those commands
Command is used to execute almost any SQL command from within the .net application.
The ADO Command object is used to execute a single query against a database. The query can perform actions like creating, adding, retrieving, deleting or updating records.If the query is used to retrieve data, the data will be returned as a RecordSet object. This means that the retrieved data can be manipulated by properties, collections, methods, and events of the Recordset object.The major feature of the Command object is the ability to use stored queries and procedures with parameters.
SQL Command is ADO.Net Object and it used for execute the query,Stored Procedures and get the result. SQLCommand object Return Integer value.
command object is used to execute any backend queries or stored procedure from the presentation layer.
command object is used to provide the sql command from fron end.