Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 02-18-2008, 12:22 AM
ZarrinPour ZarrinPour is offline
Senior Member
 
Join Date: Jul 2003
Posts: 232
Default ADODataset.....Using Custom Filter .....

Hi

I'm using AdoDataset for Retreiving Data from SqlServer.
and sometimes i take the advantage of FILTER property of this component BUT sometimes i need to write a complex or
let say Function-Oriented Criteria to filter my Dataset based on !!! for example imagine the following Filter:

AdoDataset1.Filter:='FLD1>0 AND FLD2='11''

this filter is simple an workable BUT what about this:

AdoDataset1.Filter:='FLD1>0 AND CAST(FLD3 as Char(2))='11''

..it will cause the runtime Error...because you can't use Sql Server functions here...Could anyone help me?

Above all and in general is it possible to write a Custom
Function(in a delphi unit) and use it in the Filter at runtime? something like this:

function MyFunc(...):...
begin
Result := My custom result basedon some algorithms.
end;

and then ... AdoDataset1.Filter:='MyFunc(FLD12)=1'

Thanks in advance.
Kind Regards.
Reply With Quote
  #2  
Old 02-18-2008, 02:34 AM
mshkolnik mshkolnik is offline
Senior Member
 
Join Date: Jul 2001
Posts: 4,195
Default RE: ADODataset.....Using Custom Filter .....

You need use the OnFilterRecord event instead Filter property.
There in event handler you may call any your custom functions

With best regards, Mike Shkolnik
http://www.scalabium.com
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 01:56 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.