J
jeary
Unregistered / Unconfirmed
GUEST, unregistred user!
客戶端;
try
SocketConnection.AppServer.wz_begin
Trans();
with ntstock_dDataSetdo
begin
DisableControls;
First;
for i:=1 to RecordCountdo
begin
Edit;
_str1:=FieldByName('cpnumber').Value;
_str2:=FieldByName('number').Value;
if varisnull(FieldByName('memo').Value)then
_str3:=''
else
_str3:=FieldByName('memo').Value;
{***********調用中間層方法,并返回狀態值*************}
SocketConnection.AppServer.SetStockSumnt(1,_str1,_str2,dbedit1.Text,_str3,_resultvalue);
//遍歷每一筆明細資料,并且調用appserver接口存檔.
if not(_resultvalue='') then
//showmessage(_resultvalue);
_resultvalue2:=_resultvalue2+_resultvalue;
Next;
end;
end;
if _resultvalue2='' then
SocketConnection.AppServer.wz_CommitTrans()
else
begin
messagedlg('中間層存檔時發生錯誤,具体原因是:'+_resultvalue2+',按确定開始事務回混',mtinformation,[mbok],0);
SocketConnection.AppServer.wz_RollbackTrans();
end;
except
messagedlg('寫入資料庫發生錯誤.',mtinformation,[mbok],0);
SocketConnection.AppServer.wz_RollbackTrans();
exit;
end;
中間層
procedure Tstockdata.SetStockSumNT(PA1: Smallint;
const PA2, PA3, PA4,
PA5: WideString;
out PA6: WideString);
..............
.....省略.....
..............
with TmpDataSetdo
begin
try
[red]Connection.begin
Trans;[/red] //循環第一次時此語句有錯誤.直接跳到了except后 //第二次后沒有錯誤.郁悶ing.
Edit;
UpdateBatch();
Connection.CommitTrans;
pa6:='存檔成功.';
except
Connection.RollbackTrans;
pa6:='存檔失敗.';
end;
end;
try
SocketConnection.AppServer.wz_begin
Trans();
with ntstock_dDataSetdo
begin
DisableControls;
First;
for i:=1 to RecordCountdo
begin
Edit;
_str1:=FieldByName('cpnumber').Value;
_str2:=FieldByName('number').Value;
if varisnull(FieldByName('memo').Value)then
_str3:=''
else
_str3:=FieldByName('memo').Value;
{***********調用中間層方法,并返回狀態值*************}
SocketConnection.AppServer.SetStockSumnt(1,_str1,_str2,dbedit1.Text,_str3,_resultvalue);
//遍歷每一筆明細資料,并且調用appserver接口存檔.
if not(_resultvalue='') then
//showmessage(_resultvalue);
_resultvalue2:=_resultvalue2+_resultvalue;
Next;
end;
end;
if _resultvalue2='' then
SocketConnection.AppServer.wz_CommitTrans()
else
begin
messagedlg('中間層存檔時發生錯誤,具体原因是:'+_resultvalue2+',按确定開始事務回混',mtinformation,[mbok],0);
SocketConnection.AppServer.wz_RollbackTrans();
end;
except
messagedlg('寫入資料庫發生錯誤.',mtinformation,[mbok],0);
SocketConnection.AppServer.wz_RollbackTrans();
exit;
end;
中間層
procedure Tstockdata.SetStockSumNT(PA1: Smallint;
const PA2, PA3, PA4,
PA5: WideString;
out PA6: WideString);
..............
.....省略.....
..............
with TmpDataSetdo
begin
try
[red]Connection.begin
Trans;[/red] //循環第一次時此語句有錯誤.直接跳到了except后 //第二次后沒有錯誤.郁悶ing.
Edit;
UpdateBatch();
Connection.CommitTrans;
pa6:='存檔成功.';
except
Connection.RollbackTrans;
pa6:='存檔失敗.';
end;
end;