delphi7 dbexpress 事务管理特大问题? |
|
xuhuai
一般會員 發表:4 回覆:2 積分:1 註冊:2006-07-19 發送簡訊給我 |
中间层更新多表 function Tqiwaitest.jinhhoProviderDataRequest(Sender: TObject; Input: OleVariant): OleVariant; var atd:ttransactiondesc; li_e1,li_e2:integer; begin if (not self.SQLConnection1.InTransaction) then begin atd.TransactionID:=1; atd.IsolationLevel:=xilreadcommitted; self.SQLConnection1.StartTransaction(atd); try if not varisnull(input[1]) then begin self.jinhhodetailProvider.ApplyUpdates(input[1],0,li_e2); // if li_e2>0 then // sysutils.Abort; end; if not varisnull(input[0]) then begin self.jinhhoprovider.ApplyUpdates(Input[0], 0, li_e1); /// if li_e1>0 then // sysutils.Abort; end; if li_e1 li_e2= 0 then begin SQLConnection1.Commit(atd); result:='保存成功'; end else begin self.SQLConnection1.Rollback(atd); result:='保存失败'; end; except on E : Exception do begin self.SQLConnection1.Rollback(atd); Raise Exception.Create(E.Message); end; end; end; end; 其中如果有一个表更新失败,第二个表也能更新成功, self.SQLConnection1.Rollback(atd); 这个语句不起作用。还有这个确认语句SQLConnection1.Commit(atd);也不起作用。要不要都一样。 以个情况直接影响我用dbexpress 开发多层结构程序的信心???????? 这里有谁用dbexpress开发多层结构程序成功事例? |
xuhuai
一般會員 發表:4 回覆:2 積分:1 註冊:2006-07-19 發送簡訊給我 |
|
xuhuai
一般會員 發表:4 回覆:2 積分:1 註冊:2006-07-19 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |