用事务实现多表同时删除数据
作者:互联网
eg:三个表:T_DESIGN为主表,T_PROC_INST为中间表(外键为DESIGNE_ID与主表ID关联),T_PROC_FILE为存储文件表(外键表为PROC_INST_ID与T_PROC_INST表的主键ID关联)
public bool DelData(decimal caseId)
{
ArrayList arr = new ArrayList();
arr.Add("delete from T_PROC_FILE where PROC_INST_ID in (select ID from T_PROC_INST where DESIGNE_ID in (select ID from T_DESIGN where ID='" + caseId + "'))");
arr.Add("delete from T_PROC_INST where DESIGNE_ID in (select ID from T_DESIGN where ID='" + caseId + "')");
arr.Add("delete from T_DESIGN where ID='" + caseId + "'");
return GAEA.DATA.DBUtility.DbHelperOra.ExecuteSqlTran(arr);
}
标签:事务,多表,删除,where,arr,caseId,INST,PROC,ID 来源: https://blog.csdn.net/qq_41760419/article/details/91954297