public bool DelExist(string zid, string sid) { string st_ipc = string.Format("delete from st_ipc where ztid={0} and sid='{1}'", ztid, sid); string st_pa = string.Format("delete from st_pa where ztid={0} and sid='{1}'", ztid, sid); string st_pr = string.Format("delete from st_pr where ztid={0} and sid='{1}'", ztid, sid); string show_base = string.Format("delete from show_base where ztid={0} and sid='{1}'", ztid, sid); string st_iv = string.Format("delete from st_iv where ztid={0} and sid='{1}'", ztid, sid); string st_pns = string.Format("delete from st_pns where ztid={0} and sid='{1}'", ztid, sid); string st_ans = string.Format("delete from st_ans where ztid={0} and sid='{1}'", ztid, sid); string st_dmc = string.Format("delete from st_dc where ztid={0} and sid='{1}'", ztid, sid); string st_fml = string.Format("delete from st_fml where ztid={0} and sid='{1}'", ztid, sid); string st_dt = string.Format("delete from st_dt where ztid={0} and sid='{1}'", ztid, sid); using (MySqlConnection conn = MySqlDbAccess.GetMySqlConnection()) { conn.Open(); MySqlTransaction trans = conn.BeginTransaction(); MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_ipc); MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_pa); MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_pr); MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, show_base); MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_iv); MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_pns); MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_ans); MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_dmc); MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_fml); MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_dt); trans.Commit(); } return(true); }
/// <summary> /// 删除专题库 /// </summary> /// <param name="id"></param> /// <returns></returns> public static bool DelZTDB(string ztid, string ztname) { //string st_ipc = string.Format("delete from st_ipc where ztid={0}", ztid); //string st_pa = string.Format("delete from st_pa where ztid={0}", ztid); //string st_pr = string.Format("delete from st_pr where ztid={0}", ztid); //string show_base = string.Format("delete from show_base where ztid={0}", ztid); //string st_iv = string.Format("delete from st_iv where ztid={0}", ztid); //string st_pns = string.Format("delete from st_pns where ztid={0}", ztid); //string st_ans = string.Format("delete from st_ans where ztid={0}", ztid); //string st_dmc = string.Format("delete from st_dc where ztid={0}", ztid); //string st_fml = string.Format("delete from st_fml where ztid={0}", ztid); //string st_dt = string.Format("delete from st_dt where ztid={0}", ztid); //string st_ztlist = string.Format("delete from st_ztlist where id={0}", ztid); string st_ztlist = string.Format("update st_ztlist set isdel=1 where id={0}", ztid); using (MySqlConnection conn = MySqlDbAccess.GetMySqlConnection()) { conn.Open(); MySqlTransaction trans = conn.BeginTransaction(); //MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_ipc); //MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_pa); //MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_pr); //MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, show_base); //MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_iv); //MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_pns); //MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_ans); //MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_dmc); //MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_fml); //MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_dt); MySqlDbAccess.ExecNoQuery(trans, CommandType.Text, st_ztlist); trans.Commit(); } log.Info("删除专题库:" + ztname + "\t成功\t" + DateTime.Now.ToString()); return(true); }