//AJ: the using statement ensure that .Dispose is called on IDisposable objects
//AK: Once they are finished with
using(SqlConnection conn = new SqlConnection(connString))
{
using (SqlCommand cmd = conn.CreateCommand())
{
//AJ: set this to stored proc if your using stored procs
cmd.CommandType = System.Data.CommandType.Text;
//AJ: change this to the name of the stored proc if your using stored procs
cmd.CommandText = @"Sql statement goes here";
//AJ: look into using parameters for security
SqlParameter param = new SqlParameter();
param.ParameterName = @"ParamName";
param.Direction = System.Data.ParameterDirection.Input;
param.Value = "somevalue";
//AJ: look up the different execute types for the approriate one to use
//AJ: for the situation
cmd.ExecuteNonQuery();
}
}