Populate ListBox with Stored Proc by passing Query parameter

edited 12:57AM in FastReport .NET
Hi,

I am calling a MySQL stored procedure to get data. The idea is to pass a query parameter via script, get data and populate a listbox control by binding the DataColumn via GetColumnValue to the data the proc returns.

Code:

call storedProc (@Parameter1)

Now if I want to pass the parameter value via script, as per the forum posts, a query parameter cannot be passed. Therefore we use a "report" parameter

My steps:

Parameter1 , type String, Expression: [Parameter1]
defined in the query parameter window

Parameter1, type String, Expression: [Parameter1]
defined in Data|Parameter

When I execute the SetParameter Value via the script, like so: Report.SetParameterValue ("Parameter1", "abc") in the Form Load event, nothing happens.

The parameter value "abc" is not passed to my query. What am I doing wrong? I am doing all this via script in the report.

Please help. Do I have to load the report first (even if I'm working via script?)

Comments

  • edited 12:57AM
    Hello,
    wrote:
    Parameter1, type String, Expression: [Parameter1]
    defined in Data|Parameter

    You shouldn't set the Expression here - you will get infinite loop when trying to calculate the parameter value.
    wrote:
    When I execute the SetParameter Value via the script, like so: Report.SetParameterValue ("Parameter1", "abc") in the Form Load event, nothing happens.

    Try to do that in the report's StartReport event.

    BTW, to populate a ListBox with column values, you may use Data Filtering as described in the user's manual ("Dialogue forms/Automatic filtering - how it works", and the next chapters).

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.