Macro of MyScript for TDateTime type not working
Posted: Wed 12 Jan 2005 09:22
Hi,
The macro of MyScript for TDateTime type is not working in my following code. My SQL statement is as follow:
SELECT * FROM SHTrx WHERE TrxDate BETWEEN &FromDate AND &ToDate;
procedure TForm1.Button1Click(Sender: TObject);
begin
MyScript1.SQL.Assign(Memo1.Lines);
MyScript1.MacroByName('FromDate').AsDateTime := FromDate.DateTime;
MyScript1.MacroByName('ToDate').AsDateTime := ToDate.DateTime;
MyScript1.Execute;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
MyScript1.SQL.Assign(Memo2.Lines);
MyScript1.Execute;
end;
It does not work but it work if I use the following SQL instead:
SELECT * FROM SHTrx WHERE TrxDate BETWEEN '2004-01-01' AND '2004-12-31';
Please help. Thanks
If you need the test program, please email to me.
Jonathan Liaw
The macro of MyScript for TDateTime type is not working in my following code. My SQL statement is as follow:
SELECT * FROM SHTrx WHERE TrxDate BETWEEN &FromDate AND &ToDate;
procedure TForm1.Button1Click(Sender: TObject);
begin
MyScript1.SQL.Assign(Memo1.Lines);
MyScript1.MacroByName('FromDate').AsDateTime := FromDate.DateTime;
MyScript1.MacroByName('ToDate').AsDateTime := ToDate.DateTime;
MyScript1.Execute;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
MyScript1.SQL.Assign(Memo2.Lines);
MyScript1.Execute;
end;
It does not work but it work if I use the following SQL instead:
SELECT * FROM SHTrx WHERE TrxDate BETWEEN '2004-01-01' AND '2004-12-31';
Please help. Thanks
If you need the test program, please email to me.
Jonathan Liaw