Easiest way to pass parameters to ActiveReports report from .NET code
-
10-02-2021 - |
Pergunta
How does one pass parameters needed by my SQL query in an ActiveReports report? I know about the code that goes into the ReportStart event, but how does one pass the values of the parameters to the report?
Solução
Figured it out. From your class running the report:
var report = new MyReport();
report.Parameters["Parm1"].PromptUser = false;
report.Parameters["Parm1"].Value = someVariable;
report.Parameters["Parm2"].PromptUser = false;
report.Parameters["Parm2"].Value = someVariable2.ToString("M-d-yyyy");
report.Run();
Apparently, when one new ups the report, it is parsed for parameters and they are added to the Parameters collection. So you would just need to set the properties as one wishes.
Outras dicas
There is another way of doing it, please check here. http://www.daniweb.com/software-development/csharp/threads/230041/active-reports-passing-variable-to-ar-class
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow