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.