selas
asked on
problem with query
on form i have two buttons, dbgrid and dbchart
on button press:
procedure TForm1.Button1Click(Sender : TObject);
begin
Series1.YValues.ValueSourc e := '';
AdoQuery1.Fields.Clear;
AdoQuery1.SQL.Clear;
AdoQuery1.SQL.Add('select krupje, laikas, sum(viso) from chipsai where laikas > '+QuotedStr(DatetoStr(Date TimePicker 1.Date - 1))+' group by krupje order by laikas');
AdoQuery1.Open;
AdoQuery1.FieldDefList.Upd ate;
Series1.YValues.ValueSourc e := 'sum(viso)';
end;
procedure TForm1.Button2Click(Sender : TObject);
begin
Series1.YValues.ValueSourc e := '';
AdoQuery1.Fields.Clear;
AdoQuery1.SQL.Clear;
AdoQuery1.SQL.Add('select krupje, laikas, sum(skirtumas) from chipsai where laikas > '+QuotedStr(DatetoStr(Date TimePicker 1.Date - 1))+' group by krupje order by laikas');
AdoQuery1.Open;
AdoQuery1.FieldDefList.Upd ate;
Series1.YValues.ValueSourc e := 'sum(skirtumas)';
end;
if i press one button all works fine, but if i press after any button i got error:
AdoQuery1: Field '' not found.
if there is no dbgrid all works fine too
How to fix it?
on button press:
procedure TForm1.Button1Click(Sender
begin
Series1.YValues.ValueSourc
AdoQuery1.Fields.Clear;
AdoQuery1.SQL.Clear;
AdoQuery1.SQL.Add('select krupje, laikas, sum(viso) from chipsai where laikas > '+QuotedStr(DatetoStr(Date
AdoQuery1.Open;
AdoQuery1.FieldDefList.Upd
Series1.YValues.ValueSourc
end;
procedure TForm1.Button2Click(Sender
begin
Series1.YValues.ValueSourc
AdoQuery1.Fields.Clear;
AdoQuery1.SQL.Clear;
AdoQuery1.SQL.Add('select krupje, laikas, sum(skirtumas) from chipsai where laikas > '+QuotedStr(DatetoStr(Date
AdoQuery1.Open;
AdoQuery1.FieldDefList.Upd
Series1.YValues.ValueSourc
end;
if i press one button all works fine, but if i press after any button i got error:
AdoQuery1: Field '' not found.
if there is no dbgrid all works fine too
How to fix it?
does your dbgrid have persistent columns?
ASKER
If look in dbgrid column editor there is no columns...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I've answered this question.
yep, geo answered this q and deserves the points