W
wwq007007
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TDatas.YlAfterDelZb(strFh: string;
intZy, intZBid: Integer;DJBH :string);
var
intYlid, intJcid: Integer;
dbuSl:do
uble;
dteRq: TDateTime;
fini :Tinifile;
i :integer;
begin
Tmpl.Close;
Tmpl.Sql.Text := 'select YLID,ID,RQ,SL from YLJC where djbh='''+djbh+''' order by id ';
// Tmpl.Sql.Text := 'select YLID,ID,RQ,SL from YLJC where ZY = ' + IntToStr(intZy)
// + ' and ZBID = ' + IntToStr(intZBid);
Tmpl.Open;
fini := Tinifile.Create('d:/test.ini');
adoexec.Recordset := tmpl.Recordset ;
Tmpl.Close;
adoexec.Open ;
adoexec.SaveToFile('d:/sys.txt',pfXML);
if not adoexec.IsEmpty then
begin
adoexec.First;
while not adoexec.Eofdo
begin
intJcid := adoexec.FieldByName('ID').AsInteger;
intYlid := adoexec.FieldByName('YLID').AsInteger;
dteRq := adoexec.FieldByName('RQ').AsDateTime;
dbuSl := adoexec.FieldByName('SL').AsFloat;
try
//处理原料结存数量
SqlExec(' update YL set JCSL = isnull(JCSL,0) ' + strFh + ' ' +
Float2Str(dbuSl) +
' where ID = ' + IntToStr(intYlid));
//删除明细记录
fini.WriteString('sql',inttostr(intjcid),' delete from YLJC where ID = ' + IntToStr(intJcid) );
SqlExec(' delete from YLJC where ID = ' + IntToStr(intJcid));
//处理加权价
fini.WriteString('text',inttostr(intjcid), IntToStr(intYlid));
YlSetJqj(intYlid, intJcid, dteRq, 'D');
except
on E: Exceptiondo
fini.WriteString('ERROR',inttostr(intjcid),e.Message );
end;
adoexec.Next ;
end;
end;
此程序段写在服务器段,在procedure TDatas.pYljczbAfterUpdateRecord(Sender: TObject;
SourceDS: TDataSet;
DeltaDS: TCustomClientDataSet;
UpdateKind: TUpdateKind);
begin
YlAfterDelZb(参数,参数......)
end;
中调用
在客户段删除主表时,就会执这个程序段,把细表的相关数据也删除掉.但是每次运行到SqlExec(' update YL set JCSL = isnull(JCSL,0) ' + strFh + ' ' +
Float2Str(dbuSl) +
' where ID = ' + IntToStr(intYlid));
时就会出现这个错误,可之前也有调用这个sqlexec的方法,并没有错.我测过,只要在这个循环中就会出错了,所以搞了俩个adoconn来做,还是不行.我真不知问题错的什么地方了.急求大侠帮助,献上所有积分.. 欢迎qq联系578528697 请注明delphi
intZy, intZBid: Integer;DJBH :string);
var
intYlid, intJcid: Integer;
dbuSl:do
uble;
dteRq: TDateTime;
fini :Tinifile;
i :integer;
begin
Tmpl.Close;
Tmpl.Sql.Text := 'select YLID,ID,RQ,SL from YLJC where djbh='''+djbh+''' order by id ';
// Tmpl.Sql.Text := 'select YLID,ID,RQ,SL from YLJC where ZY = ' + IntToStr(intZy)
// + ' and ZBID = ' + IntToStr(intZBid);
Tmpl.Open;
fini := Tinifile.Create('d:/test.ini');
adoexec.Recordset := tmpl.Recordset ;
Tmpl.Close;
adoexec.Open ;
adoexec.SaveToFile('d:/sys.txt',pfXML);
if not adoexec.IsEmpty then
begin
adoexec.First;
while not adoexec.Eofdo
begin
intJcid := adoexec.FieldByName('ID').AsInteger;
intYlid := adoexec.FieldByName('YLID').AsInteger;
dteRq := adoexec.FieldByName('RQ').AsDateTime;
dbuSl := adoexec.FieldByName('SL').AsFloat;
try
//处理原料结存数量
SqlExec(' update YL set JCSL = isnull(JCSL,0) ' + strFh + ' ' +
Float2Str(dbuSl) +
' where ID = ' + IntToStr(intYlid));
//删除明细记录
fini.WriteString('sql',inttostr(intjcid),' delete from YLJC where ID = ' + IntToStr(intJcid) );
SqlExec(' delete from YLJC where ID = ' + IntToStr(intJcid));
//处理加权价
fini.WriteString('text',inttostr(intjcid), IntToStr(intYlid));
YlSetJqj(intYlid, intJcid, dteRq, 'D');
except
on E: Exceptiondo
fini.WriteString('ERROR',inttostr(intjcid),e.Message );
end;
adoexec.Next ;
end;
end;
此程序段写在服务器段,在procedure TDatas.pYljczbAfterUpdateRecord(Sender: TObject;
SourceDS: TDataSet;
DeltaDS: TCustomClientDataSet;
UpdateKind: TUpdateKind);
begin
YlAfterDelZb(参数,参数......)
end;
中调用
在客户段删除主表时,就会执这个程序段,把细表的相关数据也删除掉.但是每次运行到SqlExec(' update YL set JCSL = isnull(JCSL,0) ' + strFh + ' ' +
Float2Str(dbuSl) +
' where ID = ' + IntToStr(intYlid));
时就会出现这个错误,可之前也有调用这个sqlexec的方法,并没有错.我测过,只要在这个循环中就会出错了,所以搞了俩个adoconn来做,还是不行.我真不知问题错的什么地方了.急求大侠帮助,献上所有积分.. 欢迎qq联系578528697 请注明delphi