public int SqlExecute(string sql) { int i; SqlConnection conn = new dboClass().SqlStrCon(); SqlCommand cmd = new SqlCommand(sql, conn); conn.Open(); i = cmd.ExecuteNonQuery(); conn.Close(); return(i); }
public int SqlExecute(string sql, SqlParameterCollection parameters) { int i; SqlConnection conn = new dboClass().SqlStrCon(); SqlCommand cmd = new SqlCommand(sql, conn); foreach (SqlParameter param in parameters) { cmd.Parameters.AddWithValue(param.ParameterName, param.SqlDbType).Value = param.Value; } conn.Open(); i = cmd.ExecuteNonQuery(); conn.Close(); return(i); }