with adodataset1 do begin first; while not Eof do begin for i:=1 to 10 do begin if SGHS.Cells[i,0]= trim(FieldByName('XiangM').Value) then begin if FieldByName('LeiX').Value='扣费' then begin SGHS.Cells[i,1]:=FieldByName('BiZ').Value; SGHS.Cells[i,2]:=floattostr(FieldByName('JinE').Value); end; if FieldByName('LeiX').Value='额外' then begin SGHS.Cells[i,3]:=FieldByName('BiZ').Value; SGHS.Cells[i,4]:=floattostr(FieldByName('JinE').Value); end; end; end; next; end; end;
begin
first;
while not Eof do
begin
for i:=1 to 10 do
begin
if SGHS.Cells[i,0]= trim(FieldByName('XiangM').Value) then
begin
if FieldByName('LeiX').Value='扣费' then
begin
SGHS.Cells[i,1]:=FieldByName('BiZ').Value;
SGHS.Cells[i,2]:=floattostr(FieldByName('JinE').Value);
end;
if FieldByName('LeiX').Value='额外' then
begin
SGHS.Cells[i,3]:=FieldByName('BiZ').Value;
SGHS.Cells[i,4]:=floattostr(FieldByName('JinE').Value);
end;
end;
end;
next;
end;
end;
SGHS: TStringGrid;