with ORAQuery1 do
begin
i_row := 0;
sglist2.rowcount := 0;
close;
SQL.CLEAR;
SQL.ADD(' select * from xxx ');
SQL.ADD(' where (DT = '''+t_Key+''')' );
// SQL.Add(' order by DT ');
OPEN;
while not EOF do
begin
sglist2.cells[0, i_row] := inttostr(i_row + 1);
sglist2.cells[1, i_row] := fieldbyname('a').asstring + '-' + fieldbyname('SEQ').asstring;
t_cust := fieldbyname('b').asstring;
t_prod := fieldbyname('c').asstring;
t_dept := fieldbyname('d').asstring;
t_no := fieldbyname('e').AsString;
t_kind := fieldbyname('f').AsString;
with ORAQuery2 do
begin
close;
SQL.Clear;
SQL.ADD('select * from x1 where (a = '''+t_cust+''') and (b = '''+t_dept+''')');
OPEN;
sglist2.cells[2, i_row] := fieldbyname('a').asstring;
end;
with ORAQuery2 do
begin
close;
SQL.Clear;
SQL.ADD('select * from x2 where (a = '''+t_cust+''') and (b ='''+t_dept+''') and (c = '''+t_prod+''')');
OPEN;
sglist2.cells[3, i_row] := fieldbyname('a').asstring;
end;
with ORAQuery2 do
begin
close;
SQL.Clear;
SQL.ADD('select * from x3 where DT = ('''+t_key+''') and (a ='''+t_no+''') and (b = '''+t_kind+''')');
OPEN;
sglist2.cells[4, i_row] := fieldbyname('a').asstring;
end;
with ORAQuery2 do
begin
close;
SQL.Clear;
SQL.ADD('select * from x4 where a = ('''+t_mst+''')');
OPEN;
sglist2.cells[8, i_row] := fieldbyname('a').asstring;
sglist2.cells[9, i_row] := fieldbyname('b').asstring;
end;
inc(i_row);
sglist2.rowcount := sglist2.rowcount + 1;
next;
end;
sglist2.rowcount := sglist2.rowcount - 1;
end;