FastReport Query Parameter

edited August 2020 in FastReport .NET

Hi, I hope you can help me. I need to assign a value to a parameter in FastReport. But this value can change. For example:


string x = ((String)Report.GetColumnValue("SQL")); 


if(x== 1)

{

Report.SetParameterValue("@Parameter",x);  

    txtCom.Text = ((String)Report.GetColumnValue("SQLTABLE.NAME"))

}

if(x==2)

{

Report.SetParameterValue("@Parameter",x);  

    txtCom.Text = ((String)Report.GetColumnValue("SQLTABLE.NAME"))

}


My problem is that it only runs the first time

Comments

  • Hello!

    A single call to `Report.SetParameterValue(“@Parameter”, x)` within the `BeforePrint` method is not enough to automatically restart an already open SQL data source (SQLTABLE). After changing the parameter, you need to force a reinitialization of the data source:

    Report.SetParameterValue(“@Parameter”, x);
    Report.GetDataSource(“SQLTABLE”).Init();
    
This discussion has been closed.