Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

how to add all fields to query programicaly?

Posted on 2004-10-26
4
Medium Priority
?
303 Views
Last Modified: 2012-05-05
i'm using this query:

AdoQuery1.SQL.Clear;
AdoQuery1.SQL.Add('select krupje, laikas, skirtumas, viso from chipsai where laikas > '+QuotedStr(DatetoStr(DateTimePicker1.Date - 1))+' order by laikas');
AdoQuery1.Open;

and i want to clear old field
and to add these fields to query programicaly like in fields editor
0
Comment
Question by:selas
  • 3
4 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 1500 total points
ID: 12411030
??
usual its done automatically after the open-method
you can force it with Dataset.FieldDef.Update;

just from head

meikl ;-)
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 12411368
AdoQuery1.SQL.Active := False;
AdoQuery1.SQL.Text := 'select krupje, laikas, skirtumas, viso from chipsai where laikas > '+QuotedStr(DatetoStr(DateTimePicker1.Date - 1))+' order by laikas';
AdoQuery1.SQL.Active := True;

//....

Using:
AdoQuery1.SQL.Text := ....;
you clear whole old content and replace with new one
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 12411772
If you have a problem with assigning the condition in the clause WHERE:
 .... WHERE LAIKAS > ' + QuotedStr(DatetoStr(DateTimePicker1.Date - 1)) ....

you may use a parameter:

AdoQuery1.SQL.Active := False;
AdoQuery1.SQL.Text := 'select krupje, laikas, skirtumas, viso from chipsai where LAIKAS > :PRM_LAIKAS order by laikas';
AdoQuery1.Parameters.ParamByName('PRM_LAIKAS').Value := TDateTime(DateTimePicker1.Date - 1);
AdoQuery1.SQL.Active := True;
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 12411995
let
> AdoQuery1.SQL.Active := .... // True or False;
to be
   AdoQuery1.Active := .... // True or False;

sorry ....
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This is an update to some code that someone else posted on Experts Exchange. It is an alternate approach, I think a little easier to use, & makes sure that things like the Task Bar will update.
Loops Section Overview
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question