Re: Getting Distict Values



I believe I'm using the correct select statement, but not getting the
results.

In the following code, I'm trying to get the unique AsOfDates from the file
PrepaymentSpeeds. However, I get all records given the following select
statement.

Can anyone see what I'm doing wrong?


ADODataSetPrepaymentSpeeds.Active := False;
ADODataSetPrepaymentSpeeds.CommandText := cmdText;
ADODataSetPrepaymentSpeeds.CommandText := 'SELECT DISTINCT AsOfDate FROM
PrepaymentSpeeds';

ADODataSetPrepaymentSpeeds.Active := True;
while not ADODataSetPrepaymentSpeeds.Eof do
begin
{This test should not happen since we only have two unique "AsOfDate"
values.}
Inc(iNbrOfItemsAdded);
if( iNbrOfItemsAdded > 10) then break;


cboxAsOfDate.Items.Add(FormatDateTime('mm/dd/yyyy hh:mm:ss',
ADODataSetPrepaymentSpeeds.FieldByName('AsOfDate').AsDateTime) )
end;
ADODataSetPrepaymentSpeeds.Active := False;



Thanks,
Tom



"Bill Todd [TeamB]" <no@xxxxxx> wrote in message
news:47abca9e$1@xxxxxxxxxxxxxxxxxxxxxxxxx
SELECT DISTINCT ...


--
Bill Todd (TeamB)


.