When to use ExecuteNonQuery

  • Thread starter Thread starter Ross O'Neill
  • Start date Start date
R

Ross O'Neill

Do I use ExecuteNonQuery only when I insert, delete, and update the
database?

Thanks
Ross
 
You can use it anytime you need to execute SQL or TSQL commands (DML, DDL,
or utility functions) that don't return rowsets.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
www.sqlreportingservices.net
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Ross,

I use the ExecuteNonQuery when I add records to a database, this seems to be
the most effective way (for me anyway).

T
 
Ross,

In addition to Bill,

By instance to with "Drop", "Create" etc.

I hope this helps,

Cor
 
In addition to Bill and Cor, when you need to get output parameter(s) from a
stored procedure (without returning rowsets).

HTH

Elton Wang
 
Back
Top