public static void ChangeType(string loupanid, int OpenPeriod) { string sqlStr = @""; SqlConnection con = new SqlConnection(""); SqlCommand cmd = new SqlCommand(sqlStr, con); con.Open(); SqlTransaction trans = con.BeginTransaction(); try { cmd.ExecuteNonQuery(); trans.Commit(); } catch { trans.Rollback(); } finally { con.Close(); trans.Dispose(); con.Dispose(); } }