Passing parameters to Crystal Reports from ASP.

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.