Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Error when opening a TFDQuery with parameters and macro


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 3 - Last Post: Jun 13, 2014 11:09 AM Last Post By: Dmitry Arefiev
Paulo Mariano

Posts: 29
Registered: 11/25/12
Error when opening a TFDQuery with parameters and macro  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 12, 2014 1:32 PM
Hello.

In an application built with Delphi XE5, the following exception was raised when trying to open a TFDQuery with parameters and a macro (which was initialized at design time):
Project app.exe raised exception class ETDBXNativeException with message [FireDAC][Phys][TDBX][Informix] An illegal character has been found in the statement.

These were the statements executed:
ResourceOptions.MacroCreate := True;
ResourceOptions.MacroExpand := True; 
 
// assigning Select statement to query
FDQuery1.Sql.Text := 'select *
                        from asiempdept e, asamembr m
                        where emp_dept = :emp_dept
                              and emp_club = :emp_club
                              and e.cust_code = m.cust_code
                              and e.mbr_code  = m.mbr_code
                        !ORDER';
 
// initializing parameters
FDQuery1.ParamByName ('emp_dept').AsString = '123';
FDQuery1.ParamByName ('emp_club').AsString = '456';
 
// opening the query
FDQuery1.Open;


I would appreciate if some assistance could be provided.
Thank you in advance.

Edited by: Paulo Mariano on Jun 12, 2014 1:38 PM
Dmitry Arefiev

Posts: 1,406
Registered: 12/7/03
Re: Error when opening a TFDQuery with parameters and macro  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 12, 2014 11:37 PM   in response to: Paulo Mariano in response to: Paulo Mariano
These were the statements executed:

There is no macro value assignment.

--
With best regards,
Dmitry Arefiev / FireDAC Architect
Paulo Mariano

Posts: 29
Registered: 11/25/12
Re: Error when opening a TFDQuery with parameters and macro  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 13, 2014 7:19 AM   in response to: Dmitry Arefiev in response to: Dmitry Arefiev
Dmitry Arefiev wrote:
These were the statements executed:

There is no macro value assignment.

--
With best regards,
Dmitry Arefiev / FireDAC Architect

Hello, Dmitry.

Thank you for your reply.

The value of the macro has been assigned at design time:
MacroData = <
      item
        Value = 'order by emp_dept, e.cust_code'
        Name = 'ORDER'
        DataType = mdString
      end>
Dmitry Arefiev

Posts: 1,406
Registered: 12/7/03
Re: Error when opening a TFDQuery with parameters and macro  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 13, 2014 11:09 AM   in response to: Paulo Mariano in response to: Paulo Mariano
MacroData =        item
        Value = 'order by emp_dept, e.cust_code'
        Name = 'ORDER'
        DataType = mdString
      end>

Use mdRaw instead of mdString.

--
With best regards,
Dmitry Arefiev / FireDAC Architect
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02