what is Execute NOn Query?

Answer Posted / nandu

ExecuteNonQuery

Use: when we are talking about a single database record - in Update, Insert, Delete and Get by Id. In all these cases we can use input/output/input-output parameters. Please note that from the application architecture point of view it is also good practices when your Insert and Update stored procedure returns changed record exactly like Get By Id method does.

Conclusion

Always use ExecuteNonQuery except: when you have a set of records - use ExecuteReader and when you have a single output value that cannot be defined as a parameter - use ExecuteScalar. Hope this helped to clarify something.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the difference between ado and ado.net?

684


How do we use stored procedure in ADO.NET and how do we provide parameters to the stored procedures?

756


Which object of ado contains datarow datacolumn collection?

694


What are the steps you will take to improve performance? Will you use dataset or datareader?

734


What are the advantages using ado.net?

727


What are the Data providers in ADO.Net?

739


What is adodb dll?

724


how we can fire event in databound coulm in datagfrid withot using button?

736


differance between ADO vs ADO.Net?

753


Define Execute Scalar?

740


What you mean by filtering of data?

703


What are all the different methods under sqlcommand?

696


What is row state?

701


Explain the difference between data reader and data adapter?

693


What do you know about ado.net's methods?

775