The last time Insus.net wrote a simple article, "Visual Studio 2012 uses Crystal Reports to report Crystal" http://www.cnblogs.com/insus/archive/2013/05/22/3090786.html
This article simply explains that visual Studio 2012 can be conveniently installed with the Crystal Report, which is created and displayed on the ASP.
What Insus.net want to share with you today is to pass parameters to the Crystal Report from the ASP.
First create two stored procedures, the first is the parameter, Insus.net will make this parameter a drop-down menu (DropDownList), for the user to choose.
The second stored procedure is for use by the Crystal newspaper:
Then go to the ASP. NET program, create two objects (Class):
Prepare a different class:
When we're ready, we start creating a crystal report. During the creation process, in order to reduce the space and vivid image, insus.net the process into a real-time operation. Let you slowly look.
We create a Web page on our website that is used to display the report. But our focus is to pass parameters to the Crystal Report from ASP. So first put a DropDownList on the page and bind the data to it.
Go to. aspx.cs write bindings for DropDownList:
#13 and #23 lines of code, you can refer to: http://www.cnblogs.com/insus/archive/2013/01/28/2880618.html
Now we start to display the Crystal newspaper on the webpage, add an Ammonium button (#15行html markup). Position the cursor at the #16 line, go to the toolbar, double-click
HTML markup will be generated for the line and #16 lines.
Next, we go to write the Ammonium button event:
Reference namespaces:
Using insus.net;using crystaldecisions.crystalreports.engine;using crystaldecisions.shared;
Section #34 to #39 behavior this blog post focus, parameter settings:
ParameterValues PRMV; Parameterdiscretevalue PDV = new Parameterdiscretevalue (); PRMV = rptdoc.datadefinition.parameterfields["@FruitKind_nbr"]. Currentvalues; Pdv. Value = this. DropDownList1.SelectedItem.Value; Prmv.add (PDV); rptdoc.datadefinition.parameterfields["@FruitKind_nbr"]. Applycurrentvalues (PRMV);
Finally, the real-time operation of the Web page, in the browsing, encounter some small problems, and solutions, or display some of the format of the situation, are shown.