Page 1 of 1

sending parameters from windows application to the report

Posted: Sun Jan 24, 2010 8:34 am
by imax36581
Hi
currently i designed a report with embedded parameters that work well for me.
but i want to know that is there any way to send the parameters value to the report from my windows application?
i see a video about this but in web application,i think its a little bit different in windows application.so how can i do this?
my second question is about generating the report for the second time,in a simple button i write a "strireport1.show();" code,so i can view my report,but when i try to see my report for the second time,it does not present me my form,just a blank page!.
Thanks in Advance

sending parameters from windows application to the report

Posted: Mon Jan 25, 2010 4:01 am
by Edward
Hi
imax36581 wrote:Hi
currently i designed a report with embedded parameters that work well for me.
but i want to know that is there any way to send the parameters value to the report from my windows application?
i see a video about this but in web application,i think its a little bit different in windows application.so how can i do this?
The method of passing parameters is the same. Here you are.

In the most cases you can use the following simple steps to pass parameters into the report:

1. Declare a parameter in the DataSource with the following name, for example:
@MyParameter

2. After compilation of the report:
report.Compile()

3. you can assign that parameter as follows:
report["@MyParameter"] = 5;

Here are the links on how to use named and unnamed parameters:
Named parameters:
http://www.stimulsoft.com/livedemos/Rep ... eters.html

Unnamed parameters:
http://www.stimulsoft.com/livedemos/Rep ... ers_2.html

There is another method of sending parameters using of the report variable. This method is suitable in case if non of named (@myparameter) or
unnamed (?) parameters worked as it was discussed here:
http://forum.stimulsoft.com/Default.aspx?g=posts&t=504

How to send parameters for SQL query by application?

1. You can use an expression to form any part in SQL query. First, you add variables to the SQL query:
select * from customers where code = {myvariable}

2. You need to create a variable in the Report Dictionary.

3. You need to initialize a variable before report running:

C#
StiReport report = new StiReport();
report.Load("Variables.mrt");
report.Compile();

//Set Variable
report["myvariable"] = 123;
report.Render();

VB
Dim Report As StiReport = New StiReport()
Report.Load("Variables.mrt")
Report.Compile()

'Set Variable
report.Item("myvariable") = " Value "
Report.Render()

Also please open Demo.exe sample application from the standard installation of Stimulsoft Reports.Net.

Open 'SQL' category and the report Master-Detail with Parameters. Press 'Design' button. It is another example of using parameters.

And in Program Files\Stimulsoft Reports.Ultimate 2009.3 Trial\Samples\WinForms\C#\SqlParameters\ you can find a project which describes work with parameters in Stimulsoft Reports.Net.

Additional documentation you can find here:
http://stimulsoft.com/Documentation.aspx

Also we have some other video tutorials:
http://stimulsoft.com/ReportsNetVideos.aspx
my second question is about generating the report for the second time,in a simple button i write a "strireport1.show();" code,so i can view my report,but when i try to see my report for the second time,it does not present me my form,just a blank page!.
Thanks in Advance
Please call the following method to reset rendering state of the report before launching Show() method:

stiReport1.ResetRenderedState();

Thank you.

sending parameters from windows application to the report

Posted: Tue Jan 26, 2010 7:46 am
by imax36581
thanks,but...
my code is like this:
StiReport report = new StiReport();
report.Load(".//Reports//Report_eghamat.mrt");
report.Compile();
report["@mahal"] = ComboBox1.Text;
report.Render();
report.Show();

but when it showes my report its empty,just i see my report header :( .
it seems that the parameter don't send to my report correctly.
Thanks in advance

sending parameters from windows application to the report

Posted: Tue Jan 26, 2010 7:46 am
by imax36581
thanks,but...
my code is like this:
StiReport report = new StiReport();
report.Load(".//Reports//Report_eghamat.mrt");
report.Compile();
report["@mahal"] = ComboBox1.Text;
report.Render();
report.Show();

but when it showes my report its empty,just i see my report header :( .
it seems that the parameter don't send to my report correctly.
Thanks in advance

sending parameters from windows application to the report

Posted: Tue Jan 26, 2010 11:01 am
by Jan
Hello,

Please check attached sample project.

Thank you.

sending parameters from windows application to the report

Posted: Wed Jan 27, 2010 10:18 am
by imax36581
Thank you.
i found my mistake .

sending parameters from windows application to the report

Posted: Wed Jan 27, 2010 2:21 pm
by Edward
Hi

Please let us know if any help is required.

Thank you.

Re: sending parameters from windows application to the repor

Posted: Mon Jul 01, 2013 1:16 pm
by Alex K.
Hello,

Please try to use the following code:

Code: Select all

report.Dictionary.DataSources["DataSourceName"].Parameters["ParameterName"].Value = value;