ExecuteNonQuery executes a Transact-SQL statement against the connection and returns the number of rows affected.
The ExecuteNonQuery() performs Data Definition tasks as well as Data Manipulation tasks also. The Data Definition tasks like creating Stored Procedures ,Views etc. perform by the ExecuteNonQuery() . Also Data Manipulation tasks like Insert , Update , Delete etc. also perform by the ExecuteNonQuery() of SqlCommand Object.
Although the ExecuteNonQuery returns no rows, any output parameters or return values mapped to parameters are populated with data.
The following ASP.NET program insert a new row in Discount (Pubs database) table using ExecuteNonQuery();
Click the following links to see full source code