How do we invoke queries from the application ?

Answer Posted / vivek

Command object is only one to execute queries in the
backend.
Ex:
SqlConnection cn=new SqlConnection();
SqlCommand cmd=new SqlCommand("SELECT * FROM EMP",cn);
cmd.ExecuteNonQuery();
cmd.ExecuteReader();
cmd.ExecuteScalar();
Cmd.ExecuteXmlReader();
command object has only these 4 methods to execute queries
in the backend.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Give an example that shows how to execute a stored procedure in ado.net?

559


How to bind the controls(best practice) comboboxes to the data in the dataset?

533


What is the meaning of executenonquery?

534


What is difference between datatable and dataset?

517


What is the difference between Response.Expires and Reponse.ExpiresAbsolute?

532






What is the difference between sqlcommand and sqldataadapter?

491


What is ole in excel?

511


How to generate a single aggregate?

532


Give few examples of datareader that is used in different dataproviders.

535


Which method in OLEDBAdapter is used to populate dataset with records?

552


What are the 3 major types of connection objects in ado.net?

534


What is command class in ado.net?

469


What is microsoft ado.net?

570


How to read data with the sqldatareader ?

527


Which control of the BindingNavigator returns the current position within the data source?

727