FR4 Query with parameters

edited 12:44PM in FastReport 4.0
I am using FR4 VCL (although the same applies to FR Studio)

I set up an Interbase connection
I set up an Interbase query with the text
SELECT * FROM JOB_ITEM WHERE JOB_NUMBER="01200"

I set up a Master Data Band with the JOB_NUMBER field and a Detail band with a few other fields

The report shows the data I would expect.

Now, I wish to select what job I want and change the query text to:
SELECT * FROM JOB_ITEM WHERE JOB_NUMBER=:pJOB_NUMBER
also create a variable called vJOB_NUMBER

in the query parameters, I set pJOB_NUMBER as STRING and the value to be vJOB_NUMBER

in the code page I put Set('vJOB_NUMBER','01200');

The report shows no data.

Tracing through the code in frxIBXComponents.pas, params[0] seems to be being passed the value of '01200' but no data is returned.

What do you think is happening?

Comments

  • edited 12:44PM
    Further information reveals conversion from a variant issue. i.e. a value of 10000 works but 01200 doesn't.

    So, the answer is: To use a string value, ensure it is surrounded by double single quotes, then the program won't try to make it a number.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.