中间层更新多表
function Tqiwaitest.jinhhoProviderDataRequest(Sender: TObject;
Input: OleVariant): OleVariant;
var
atd:ttransactiondesc;
li_e1,li_e2:integer;
beginif (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开发多层结构程序成功事例?
function Tqiwaitest.jinhhoProviderDataRequest(Sender: TObject;
Input: OleVariant): OleVariant;
var
atd:ttransactiondesc;
li_e1,li_e2:integer;
beginif (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开发多层结构程序成功事例?
解决方案 »
- hook住ExtTextOut后捕捉到的文字重复怎么办?
- 大家帮帮忙呀!
- [急]关于将TIcon存入数据库后失真的问题!
- 在TImage上每0.5秒定時畫波譜圖象並invalidate,顯示時經常閃動,但winamp的圖象變化更快卻不會出現,請問如何同步掃描?
- rav5 打印的問題
- 线程的小问题,高手请进!!!!!
- 请教高手:idFTP.put 假死无反应
- 急!请问如何将ADOQuery返回的记录集,另存成一个Excel文件(原来并不存在,是新建立的。),并且在第二个工作表里显示这个记录集?谢谢
- 如何赋值???(急急急!!!)
- 有没有把DCU转成PAS的工具。
- 往dbf中插图片
- 如何获得硬盘,或移动硬盘或U盘或mp3之类的存储器的id?
Input: OleVariant): OleVariant;
请大家一同讨论!