This is my (rough) code (DAL):
int i; // Some other declarations SqlCommand myCmdObject = new SqlCommand(\"some query\"); conn.open(); i = myCmdObject.Exec
The ExecuteNonQuery method is used for SQL statements that are not queries, such as INSERT, UPDATE, ... You want to use ExecuteScalar or ExecuteReader if you expect your statement to return results (i.e. a query).
ExecuteNonQuery
INSERT
UPDATE
ExecuteScalar
ExecuteReader