ADO Database Delphi

Title: Filtering a table with the SetRange method
Question: How to filter a table with the SetRange method?
Answer:
SetRange method sets the starting and ending values of a range in database.
To do this, do the following four steps:
1. Add following componenets to the Form.
TDBGrid (named as dbgrdCustomer)
TTable (named as tblCustomer)
TDataSource (named as dtsCustomer)
TButton
2. Set DatabaseName properties of the TTable to DBDEMOS and
TableName properties of the TTable to CUSTOMER.DB.
3. Set DataSet properties of the TDataSource to tblCustomer.
4. Set DataSource properties of the TDBGrid to dtsCustomer.
----------
Add the following codes to the OnCreate and OnDestroy event of your form;
procedure TForm1.FormCreate(Sender: TObject);
begin
tblCustomer.Open;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
tblCustomer.Close;
end;
-----------
and adding this code to the OnClick event of the button and run project:
procedure TForm1.Button1Click(Sender: TObject);
begin
tblCustomer.SetRangeStart;
tblCustomer[ 'CustNo' ] := 2300;
tblCustomer.SetRangeEnd;
tblCustomer[ 'CustNo' ] := 3200;
tblCustomer.ApplyRange;
end;
Finally,after filtering,we can see Customer numbers from 2300 to 3200.
Have fun.