1. <i id='0AhXW'><tr id='0AhXW'><dt id='0AhXW'><q id='0AhXW'><span id='0AhXW'><b id='0AhXW'><form id='0AhXW'><ins id='0AhXW'></ins><ul id='0AhXW'></ul><sub id='0AhXW'></sub></form><legend id='0AhXW'></legend><bdo id='0AhXW'><pre id='0AhXW'><center id='0AhXW'></center></pre></bdo></b><th id='0AhXW'></th></span></q></dt></tr></i><div id='0AhXW'><tfoot id='0AhXW'></tfoot><dl id='0AhXW'><fieldset id='0AhXW'></fieldset></dl></div>

    <tfoot id='0AhXW'></tfoot>
    <legend id='0AhXW'><style id='0AhXW'><dir id='0AhXW'><q id='0AhXW'></q></dir></style></legend>

    <small id='0AhXW'></small><noframes id='0AhXW'>

      <bdo id='0AhXW'></bdo><ul id='0AhXW'></ul>

    1. 在 asp.net 中通过 C# 将参数传递给 CRYSTAL REPORTS

      Passing parameters to CRYSTAL REPORTS via C# in asp.net(在 asp.net 中通过 C# 将参数传递给 CRYSTAL REPORTS)

          <i id='L0Ceu'><tr id='L0Ceu'><dt id='L0Ceu'><q id='L0Ceu'><span id='L0Ceu'><b id='L0Ceu'><form id='L0Ceu'><ins id='L0Ceu'></ins><ul id='L0Ceu'></ul><sub id='L0Ceu'></sub></form><legend id='L0Ceu'></legend><bdo id='L0Ceu'><pre id='L0Ceu'><center id='L0Ceu'></center></pre></bdo></b><th id='L0Ceu'></th></span></q></dt></tr></i><div id='L0Ceu'><tfoot id='L0Ceu'></tfoot><dl id='L0Ceu'><fieldset id='L0Ceu'></fieldset></dl></div>

          <small id='L0Ceu'></small><noframes id='L0Ceu'>

              <bdo id='L0Ceu'></bdo><ul id='L0Ceu'></ul>
                <tbody id='L0Ceu'></tbody>
              <tfoot id='L0Ceu'></tfoot>

              1. <legend id='L0Ceu'><style id='L0Ceu'><dir id='L0Ceu'><q id='L0Ceu'></q></dir></style></legend>
              2. 本文介绍了在 asp.net 中通过 C# 将参数传递给 CRYSTAL REPORTS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我是 Crystal Reports 的新手.我通过以下链接设计了一个水晶报表:带有 SQL 存储过程参数和 Visual Studio 的水晶报表我需要做的是将不同的 ID(SP 的输入值)传递给我与 Crystal Report 连接的 SP.

                I am new to Crystal Reports. I have designed a Crystal Report by following this link: Crystal Report with SQL Stored Procedure Parameter and Visual Studio What I need to do is pass different ID's (Input value of the SP) to the SP that I connected with the Crystal Report.

                这是我将 ID 传递给 Crystal Report 的代码:

                This is the code I have which passes the ID to the Crystal Report :

                        protected void Button1_Click(object sender, EventArgs e)
                        {
                        string QuotationID = ViewState["QUOTATION_ID"].ToString();
                        ReportDocument reportDocument = new ReportDocument();
                        ParameterField paramField = new ParameterField();
                        ParameterFields paramFields = new ParameterFields();
                        ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
                
                
                       
                        paramField.Name = "@id";
                
                
                        paramDiscreteValue.Value = QuotationID;
                
                        paramField.CurrentValues.Add(paramDiscreteValue);
                        paramFields.Add(paramField);
                
                        
                        paramFields.Add(paramField);
                
                        CrystalReportViewer1.ParameterFieldInfo = paramFields;
                
                        string reportPath = Server.MapPath("~/CrystalReport.rpt");
                
                        reportDocument.Load(reportPath);
                
                       
                        CrystalReportViewer1.ReportSource = reportDocument;
                        }
                

                但每当我点击按钮时,它都会要求输入 ID...

                But whenever I click the button it asks for the ID...

                推荐答案

                在水晶上设置参数我总是这样:

                To set parameter on crystal I always do it this way:

                ReportDocument reportDocument = new ReportDocument();
                reportDocument.Load(reportPath);
                reportDocument.SetParameterValue("@id", QuotationID);
                

                如果您想将报告转换为 pdf:

                if you want to convert your report to a pdf:

                var exportOptions = reportDocument.ExportOptions;
                exportOptions.ExportDestinationType = ExportDestinationType.NoDestination;
                exportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
                var req = new ExportRequestContext {ExportInfo = exportOptions};
                var stream = reportDocument.FormatEngine.ExportToStream(req);
                

                这会返回一个文件流,您可以从 aspx 页面打开该文件流.

                this returns you back a filestream that you can open from the aspx page.

                这篇关于在 asp.net 中通过 C# 将参数传递给 CRYSTAL REPORTS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Performance overhead of using attributes in .NET(在 .NET 中使用属性的性能开销)
                Accessing attribute info from DTE(从 DTE 访问属性信息)
                c# Hide a property in datagridview with datasource(c#使用数据源隐藏datagridview中的属性)
                Extract Display name and description Attribute from within a HTML helper(从 HTML 帮助器中提取显示名称和描述属性)
                C# Attributes and their uses(C# 属性及其用途)
                C# - Getting all enums value by attribute(C# - 按属性获取所有枚举值)
                  • <legend id='OSyjQ'><style id='OSyjQ'><dir id='OSyjQ'><q id='OSyjQ'></q></dir></style></legend>
                    <i id='OSyjQ'><tr id='OSyjQ'><dt id='OSyjQ'><q id='OSyjQ'><span id='OSyjQ'><b id='OSyjQ'><form id='OSyjQ'><ins id='OSyjQ'></ins><ul id='OSyjQ'></ul><sub id='OSyjQ'></sub></form><legend id='OSyjQ'></legend><bdo id='OSyjQ'><pre id='OSyjQ'><center id='OSyjQ'></center></pre></bdo></b><th id='OSyjQ'></th></span></q></dt></tr></i><div id='OSyjQ'><tfoot id='OSyjQ'></tfoot><dl id='OSyjQ'><fieldset id='OSyjQ'></fieldset></dl></div>
                        <tbody id='OSyjQ'></tbody>

                          <bdo id='OSyjQ'></bdo><ul id='OSyjQ'></ul>
                          <tfoot id='OSyjQ'></tfoot>

                          <small id='OSyjQ'></small><noframes id='OSyjQ'>