1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
var
i:integer;
begin
Query1.Close;
Query1.sql.clear;
Query1.sql.Add('SELECT smcode,sdate,');
Query1.sql.Add('COUNT(sccode) AS CompteDeSCCode,');
Query1.sql.Add('Sum(SPRICE) as SommeDeSPRICE FROM Sales');
Query1.SQL.Add('WHERE (smcode=:x)');
Query1.SQL.add('GROUP BY sdate, smcode');
Query1.Params[0].AsString:=AnsiUpperCase(Edit1.text);
Query1.Open;
//Query2.Close;
//Query2.sql.clear;
//Query2.sql.Add('SELECT Count(smcode)');
//Query2.sql.Add('FROM Sales');
//Query2.Open;
stringgrid1.cells[0,0]:='SMCode';
stringgrid1.cells[1,0]:='SDate';
stringgrid1.cells[2,0]:='CompteDeSCCode';
stringgrid1.cells[3,0]:='Total Nombre';
stringgrid1.cells[4,0]:='Total Montant';
stringgrid1.cells[5,0]:='Stock de Livre';
while not Query1.Eof do
begin
i:=i+1;
stringgrid1.cells[0,i+1]:=Query1.Fields[0].AsString;
stringgrid1.cells[1,i+1]:=Query1.Fields[1].AsString;
stringgrid1.cells[2,i+1]:=Query1.Fields[2].AsString;
stringgrid1.cells[3,i+1]:=Query1.Fields[3].AsString;
Query1.Next;
end; |
Partager