Re: Database Filter question
- From: "Allan Nielsen" <ace-allan@xxxxxxxxxxxxxx>
- Date: Tue, 10 May 2005 09:13:02 +0200
Thank you for your reply, I got it sorted now.
Allan
"Yannis" <None@xxxxxxxxxx> wrote in message
news:427f5980@xxxxxxxxxxxxxxxxxxxxxxxxx
> Allan Nielsen wrote:
>
> > Hello,
> >
> > I use ADO to connect to an SQL Database. I use an ADODataSet to hold a
> > complete recordset from a select query.
> >
> > Question 1:
> > When I set the Filtered property to True (ADODataset1.Filtered :=
> > true), will the dataset filter the current records that it holds, or
> > will it automatically Execute its CommandText and then filter the new
> > resultset? Or how does the Filter exactly work?
> >
> > Question 2:
> >
> > ------------------------------------------------------
> > number_before := ADODataSet1.RecordCount;
> > ADODataset1.Filter := 'address = ' +
> > ADODataset2.FieldByName('addr').AsString;
> > ADODataset1.Filtered := true;
> > number_after := ADODataset1.RecordCount;
> > -------------------------------------------------------
> >
> > Assuming that this actually filters out some records, the
> > number_before and number_after shouldn't be the same, right? Or does
> > it need a refresh somewhere?
> >
> > Delphi 2005, SQL Server 2K, btw.
> >
> > TIA
> >
> > Allan
>
> You are in the correct path You need to take in to account that the
> value needs to quoted, Change Filter property to the following
>
> ADODataset1.Filter := 'address = ' +
> QuotedStr(ADODataset2.FieldByName('addr').AsString);
>
> then test it again.
>
> Regards
> Yannis.
.
- References:
- Database Filter question
- From: Allan Nielsen
- Re: Database Filter question
- From: Yannis
- Database Filter question
- Prev by Date: Re: RETURN_VALUES ??? done... What have I gained?
- Next by Date: Re: Database Filter question
- Previous by thread: Re: Database Filter question
- Next by thread: Re: Database Filter question
- Index(es):
Relevant Pages
|