What is the difference between ExecuteReader,ExecuteNonQuery
and ExecuteScalar.

Answer Posted / chitransu verma

ExecuteNonQuery-It executes the DML
commonds(insert,update,delete)and retuns the number of
affected rows.

ExecuteScaler-Lightweight version on executenonquery.
used besically for singalton queries.
It executes the sql statements or stored procedures and
returns a scalar value form first column and first row.
It is used to execute aggregate function like
Avg().Count(*),Max(),Min() etc.When compare to ExecuteReader
It uses Fewer System Resources.

ExecuteReader-It execute sql statement and return the
DataReader Object.
It is used to select records from the tables stored in
database.

Is This Answer Correct ?    2 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which method do you use to kill explicitly a users session?

621


What is the purpose of using MVC programming pattern in ASP.NET?

553


How you can add an event handler?

573


What is state management techniques in asp.net?

526


Define view state.

548






What is the difference between typeof() vs gettype()?

549


Explain about secure socket layer?

522


In which event of the page viewstate is available?

464


What is the use of placeholder control? Can we see it at runtime?

569


How to disable validator control by client side JavaScript?

568


What is asp.net mvc? : asp.net mvc

548


What is synchronous and Asynchronous post back ?

637


Explain the concept of event bubbling in ASP.NET?

579


What is http session state?

517


What are the new login controls in asp.net 2.0?

517