Regarding Macros in SDAC.

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
eprince
Posts: 9
Joined: Mon 15 Jan 2007 06:59
Contact:

Regarding Macros in SDAC.

Post by eprince » Mon 15 Jan 2007 07:41

Hi guyz,
Recently i encountered a situation where i need to use conditional query building using the (#If - #EndIf) syntax.
e.g. :
SELECT
FROM
WHERE
#if (&MacroName = )

#endif
Order by


Where value of the macro 'MacroName' is passed through inline code.

But I was not able to execute this Query as (#If - #EndIf) is not supported by SDAC

Can some one kindly suggest me what is the work-around for this?

Jackson
Posts: 512
Joined: Thu 26 Jan 2006 10:06

Post by Jackson » Mon 15 Jan 2007 14:02

SDAC doesn't support such functionality.
You can modify your query like the following:

Code: Select all

SELECT  FROM  
WHERE  
&MacroName
Order by  
then assign the following value to this macros:

Code: Select all

MSQuery1.MacroByName('MacroName').Value := '';
and just turn it off or on depending on your conditions:

Code: Select all

MSQuery1.MacroByName('MacroName').Active := IsMacrosValueNeeds;

Post Reply