S
sward
Unregistered / Unconfirmed
GUEST, unregistred user!
如果不执行这些方法不报告错,执行时也都很正确,问题如上,请有经验的朋友帮我看看
procedure Twz_server_data.serverqueryopen(sqlstring: OleVariant);
begin
with serverquery1do
begin
close;
sql.clear;
sql.add(sqlstring);
execsql;
mainfrm.memo1.lines.add('----执行SQL------');
mainfrm.memo1.lines.add(sqlstring);
end;
end;
function Twz_server_data.serveraction(actionno, actiontext: OleVariant): OleVariant;
begin
IF actionno='重新计算总库存' then
begin
with serverquery1do
begin
close;
sql.clear;
sql.add('select codeid');
sql.add(',sum(insl) as insl');
sql.add(',sum(inje) as inje');
sql.add(',sum(nowsl) as nowsl');
sql.add(',sum(nowje) as owje') ;
sql.add(',sum(outsl) as outsl');
sql.add(',sum(outje) as outje') ;
sql.add(' from kc_mini group by codeid order by codeid') ;
open;
end;
with serverquery2do
begin
close;
sql.text:='update stock set insl=0,inje=0,outje=0,outsl=0,nowsl=0,nowje=0' ;
execsql;
serverquery1.first ;
while not serverquery1.eofdo
begin
close;
sql.clear;
sql.add('update stock set ');
sql.add(' inje='+serverquery1.fieldbyname('inje').asstring);
sql.add(' insl='+serverquery1.fieldbyname('insl').asstring);
sql.add(' outje='+serverquery1.fieldbyname('outje').asstring);
sql.add(' outsl='+serverquery1.fieldbyname('outsl').asstring);
sql.add(' nowje='+serverquery1.fieldbyname('nowje').asstring);
sql.add(' nowsl='+serverquery1.fieldbyname('nowsl').asstring);
sql.add(' where codeid='+serverquery1.fieldbyname('codeid').asstring);
execsql;
serverquery1.next;
end;
end;
serverquery1.close;
serverquery2.close;
end ;
//else
begin
mainfrm.memo1.lines.add('----');
mainfrm.memo1.lines.add(actionno);
mainfrm.memo1.lines.add(actiontext);
result:=DateTimeToStr(Now)+'act ok!';
end;
end;
procedure Twz_server_data.serverqueryopen(sqlstring: OleVariant);
begin
with serverquery1do
begin
close;
sql.clear;
sql.add(sqlstring);
execsql;
mainfrm.memo1.lines.add('----执行SQL------');
mainfrm.memo1.lines.add(sqlstring);
end;
end;
function Twz_server_data.serveraction(actionno, actiontext: OleVariant): OleVariant;
begin
IF actionno='重新计算总库存' then
begin
with serverquery1do
begin
close;
sql.clear;
sql.add('select codeid');
sql.add(',sum(insl) as insl');
sql.add(',sum(inje) as inje');
sql.add(',sum(nowsl) as nowsl');
sql.add(',sum(nowje) as owje') ;
sql.add(',sum(outsl) as outsl');
sql.add(',sum(outje) as outje') ;
sql.add(' from kc_mini group by codeid order by codeid') ;
open;
end;
with serverquery2do
begin
close;
sql.text:='update stock set insl=0,inje=0,outje=0,outsl=0,nowsl=0,nowje=0' ;
execsql;
serverquery1.first ;
while not serverquery1.eofdo
begin
close;
sql.clear;
sql.add('update stock set ');
sql.add(' inje='+serverquery1.fieldbyname('inje').asstring);
sql.add(' insl='+serverquery1.fieldbyname('insl').asstring);
sql.add(' outje='+serverquery1.fieldbyname('outje').asstring);
sql.add(' outsl='+serverquery1.fieldbyname('outsl').asstring);
sql.add(' nowje='+serverquery1.fieldbyname('nowje').asstring);
sql.add(' nowsl='+serverquery1.fieldbyname('nowsl').asstring);
sql.add(' where codeid='+serverquery1.fieldbyname('codeid').asstring);
execsql;
serverquery1.next;
end;
end;
serverquery1.close;
serverquery2.close;
end ;
//else
begin
mainfrm.memo1.lines.add('----');
mainfrm.memo1.lines.add(actionno);
mainfrm.memo1.lines.add(actiontext);
result:=DateTimeToStr(Now)+'act ok!';
end;
end;