Click here to Skip to main content
15,881,559 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi this is my code and I don't know where is the problem so help me please to fix it thanks

What I have tried:

procedure TForm1.Button1Click(Sender: TObject);
begin
ADODataSet1.Close;
ADODataSet1.CommandText :='[Date]>='+quotedStr(DateToStr(Date1.date))+'and'+'[Date]<='+QuotedStr(DateToStr(Date2.Date));
ADODataSet1.Active := True;
ADODataSet1.Requery();
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
ADODataSet1.Close;
end;
end.
Posted
Updated 20-Jul-18 1:35am

1 solution

Your CommandText property should be a complete SQL statement, not just a filter.

Either use parameters in the full SQL statement, or use your existing code as a filter.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900