Click here to Skip to main content
14,775,228 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi
I have a report in windows form application that it's designed by Stimulsoft report generator. My report get data from MySQL database by a stored procedure.
My stored procedure has a parameter as PersonalCode and my report has a parameter with same name.
I want load report file and pass a value to this parameter.
I use from some solutions that are listed in bellow, but all of them is not correct:

First Way:
Stimulsoft.Report.StiReport report = new Stimulsoft.Report.StiReport();
report.Load("mrt file path");
report.Compile();
report.Variables["PersonalCode"] = 932;
report.Render();
report.Show();

Second Way:
Stimulsoft.Report.StiReport report = new Stimulsoft.Report.StiReport();
report.Load("mrt file path");
report["PersonalCode"] = 932;
report.Show();

Third Way:
Stimulsoft.Report.StiReport report = new Stimulsoft.Report.StiReport();
report.Load("mrt file path");
report.Compile();
Stimulsoft.Report.Dictionary.StiDataParameter parameter = new Stimulsoft.Report.Dictionary.StiDataParameter();
parameter.Name = "PersonalCode";
parameter.Value = "932";
report.DataSources["PersonalInformation"].Parameters["PersonalCode"] = parameter;
report.Render();
report.Show();

Fourth Way:
Stimulsoft.Report.StiReport report = new Stimulsoft.Report.StiReport();
report.Load("mrt file path");
report.Compile();
Stimulsoft.Report.Dictionary.StiVariable parameter = new Stimulsoft.Report.Dictionary.StiVariable("PersonalCode", typeof(int));
parameter.Value = "932";
report.Dictionary.Variables["PersonalCode"] = parameter;
report.Render();
report.Show();


Please help my,
How I can pass a value as parameter to report in .net that this parameter is a parameter for stored procedure that provide report data?
Posted
Updated 23-Sep-20 11:37am
v2

Hi
I solve my problem by bellow code:
report.Compile();
report["Number"] = 932;
report.Render();
report.Show();


But You must attention to bellow notice:
1- Stored procedure parameter names's must be "Number"
2- Report parameter name's must be "Number"
3- Sent parameter name's must be "Number"

Thanks
   
v2
Open a support ticket with your question at Stimulsoft forums on :
http://forum.stimulsoft.com/[^]
There you get full support for the software developers also you provide them with code sample of your work.
Thank you
   
Hi
I solve my problem by bellow code:
Collapse | Copy Code
report.Compile();
report["Number"] = 932;
report.Render();
report.Show();

But You must attention to bellow notice:
1- Stored procedure parameter names's must be "Number"
2- Report parameter name's must be "Number"
3- Sent parameter name's must be "Number"

Thanks
   
Please try to use the following code for set the parameters value:
report.Dictionary.DataSources["DataSourceName"].Parameters["ParameterName"].ParameterValue = yourValue;
   
StiReport report = new StiReport();
            report.Compile();
            Stimulsoft.Report.Dictionary.StiDataParameter parameter = new Stimulsoft.Report.Dictionary.StiDataParameter();
            parameter.Name = "Active";
            parameter.Value = "9";
            report.Load(@"D:\data\MRT\deliveryorder.mrt");
            report.DataSources["vw_vendorCopy"].Parameters["Active"] = parameter;
   
This worked for me.
var report = new StiReport();
report.Compile();
// Set report parameters or variables
var parameter = new Stimulsoft.Report.Dictionary.StiVariable("variableName","variableValue");
report.Dictionary.Variables["variableName"] = parameter;
//...
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900