Re: TADODataset.Filter?




"Dennis Passmore" <dennis_passmore@xxxxxxxxxxxxxxxx> wrote in message
news:lfbmj2lpbs5k0m9ujqb13smlor6o08onvi@xxxxxxxxxx
The following code works fine for me using either a ADOQuery or
ADODataSet.
The actual SQL text was
'select * from Employees'
from the MsSql NorthWind database.


procedure TForm1.Button1Click(Sender: TObject);
begin
// ADOQuery1.Close;
// ADOQuery1.Filter := 'LastName Like ' + QuotedStr('Fu*'); //Fuller
// ADOQuery1.Filtered := true;
// ADOQuery1.Open;
ADODataSet1.Close;
ADODataSet1.Filter := 'LastName Like ' + QuotedStr('Fu*'); //Fuller
ADODataSet1.Filtered := true;
ADODataSet1.Open;
end;

Thanks, I didn't close my ADODataset, I only set 'filtered' to false
before changing 'filter'. (That was how I understood the little sample
code provided with the online help on TADODataset.Filter).

But if I close the dataset will then not also the SQL SELECT command
be executed again when I reopen the dataset? If that is so I cannot see
any reason for using filter instead of just SQL SELECT ... WHERE... ?

regards Sven


.


Quantcast