Executes a SQL-Statement on the Database.
ExecuteQuery()------> To Execute SELECT Statement
The ExecuteNonQuery() is one of the most frequently used method in SqlCommand Object, and is used for executing statements that do not return result sets (ie. statements like insert data , update data etc.) .
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.
The following C# example shows how to use the method ExecuteNonQuery() through SqlCommand Object
SqlConnection cnn = new SqlConnection(connetionString);
SqlCommand cmd = new SqlCommand("insert into tablename(id,name) values(11,'naresh')", cnn);