What is the difference between ExecuteReader,ExecuteNonQuery
and ExecuteScalar.

Answer Posted / jerry joseph

ExecuteReader - This method returns a DataReader which is
filled with the data that is retrieved using the command
object.

ExecuteNonQuery - This method returns no data at all. It is
used majorly with Inserts and Updates of tables.

ExecuteScalar - Returns only one value after execution of
the query. It returns the first field in the first row.

This would be excellent for receiving a count of records
(Select Count(*)) in an sql statement, or for any query
where only one specific field in one column is required.

Is This Answer Correct ?    35 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Give an example of cookie abuse.

593


Which Is Faster MVC or ASP.net ?

579


What is a response cookie?

606


Take a Large textbox allow to type any data. Task 1:display the count of vowels in a lable on key press event of the textbox Task 2:dispaly count of dates in a lable when dates in following foramats:dd/mm/yy , mm/dd/yy , yy/mm/dd. Task3:compare 2 dates and display both are same or not which dates are in dd/mm/yy and mm/dd/yy farmats.

2591


Which is faster union or union all?

570






Explain the role of global.asax?

545


What is http response header?

557


Explain asp.net application life cycle?

546


What is the page life cycle in asp.net?

557


Are cookies client side or server side?

494


Explain exception handling in .net.

607


Explain about consistent programming model in the .NET framework?

589


when a request is made in Life cycle of ASP.NET page .

527


What is a session government?

497


How does asp.net work?

547