procedure TVOUCHER_ENTER.DataSetBroker2BeforeApplyUpdates(DataSet: TDataSet);
var lDataSet1,lDataSet2: TDataSet;
lf_SumOrigin, lf_sumrmb:float;
begin
lDataSet1 := DataSetBroker1.DataSet;
if not lDataSet1.Active then
lDataSet1.Open;
lDataSet2 := DataSetBroker2.DataSet;
if not lDataSet2.Active then
lDataSet2.Open;
lf_sumorigin:= 0;
lf_sumrmb:= 0;
with lDataSet2 do
begin
First;
while not Eof do
begin
lf_sumorigin:= lf_sumorigin + lDataSet2.FieldByName('BalTtl').AsFloat;
lf_sumrmb:= lf_sumrmb + lDataSet2.FieldByName('BalStdTtl').AsFloat;
next;
end;
end;
if not(lDataSet1.State in [TDataSetState.dsEdit,TDataSetState.dsInsert]) then
begin
TSqlDataSet(lDataSet1 as TDataSet).Edit;
end;
lDataSet1.FieldByName('VouSumOrigin').AsFloat := lf_sumorigin;
lDataSet1.FieldByName('VouSumRmb').AsFloat := lf_sumrmb;
lDataSet1.Post;
end;
程序执行到最后时报错:运行系统初始化的时候发生异常:正在提交类型:Exception。
什么原因啊