<legend id='hHK6y'><style id='hHK6y'><dir id='hHK6y'><q id='hHK6y'></q></dir></style></legend>

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

    • <bdo id='hHK6y'></bdo><ul id='hHK6y'></ul>
      1. <small id='hHK6y'></small><noframes id='hHK6y'>

        在 C# 中将参数传递给水晶报表

        时间:2023-07-10
        <legend id='vIGCl'><style id='vIGCl'><dir id='vIGCl'><q id='vIGCl'></q></dir></style></legend>
        • <tfoot id='vIGCl'></tfoot>
              <tbody id='vIGCl'></tbody>
            <i id='vIGCl'><tr id='vIGCl'><dt id='vIGCl'><q id='vIGCl'><span id='vIGCl'><b id='vIGCl'><form id='vIGCl'><ins id='vIGCl'></ins><ul id='vIGCl'></ul><sub id='vIGCl'></sub></form><legend id='vIGCl'></legend><bdo id='vIGCl'><pre id='vIGCl'><center id='vIGCl'></center></pre></bdo></b><th id='vIGCl'></th></span></q></dt></tr></i><div id='vIGCl'><tfoot id='vIGCl'></tfoot><dl id='vIGCl'><fieldset id='vIGCl'></fieldset></dl></div>

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

                <bdo id='vIGCl'></bdo><ul id='vIGCl'></ul>

                1. 本文介绍了在 C# 中将参数传递给水晶报表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我一直试图让它工作一段时间,我看到的所有示例代码都没有完全按照我正在做的事情.

                  I've been trying to get this to work for a while, and all the example code I've seen aren't quite doing what I'm doing.

                  我有一个程序,它返回我将数据表传递给的报告的 pdf.这很好用,除了我想向它传递几个其他参数(表格的日期范围、统计数据等),我就是无法让它工作.我的代码基本上是这样的.

                  I have a program that returns a pdf of a report that I pass a data table to. This works fine, except I would like to pass it a couple of other parameters (the date range of the table, stats etc) and I just can't get it to work. My code basically looks like this.

                  ReportDocument myDataReport = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
                  myDataReport.Load(@"C:LayoutsReport.rpt");
                  ParameterField myParam = new ParameterField();
                  ParameterDiscreteValue myDiscreteValue = new ParameterDiscreteValue();
                  myParam.ParameterFieldName = "MyParameter";
                  myDiscreteValue.Value = "Hello";
                  myParam.CurrentValues.Add(myDiscreteValue);
                  myDataReport.ParameterFields.Add(myParam);
                  myDataReport.SetDataSource(myDataTable);
                  Stream returnData = myDataReport.ExportToStream(PortableDocFormat);
                  myDataReport.Close();
                  return returnData;
                  

                  我已经在水晶的rpt文档中添加了参数字段,我是否必须在c#中更改xsd文件中的任何内容,还是我错过了完全不同的东西?

                  I have added the parameter field in the rpt document in crystal, do I have to change anything in the xsd file in c#, or am I missing something completely different?

                  非常感谢,安迪.

                  推荐答案

                  所有参数代码都可以替换为...

                  All that parameter code can be replaced with...

                  // Set datasource first
                  myDataReport.SetDataSource(...)
                  // Assign Paramters after set datasource
                  myDataReport.SetParameterValue("MyParameter", "Hello");
                  

                  我不记得在设置数据源和参数时顺序是否重要.也许先尝试设置数据源.xsd/datasource 与晶体参数无关.

                  I can't remember if the order matters when setting the datasource and parameters. Maybe try setting the datasource first. The xsd/datasource has no relation to crystal parameters.

                  更新1

                  在数据源分配之后设置参数值否则您将收到错误缺少参数值".

                  SetParameterValue AFTER the datasource asignation or you will recieve error "Missing parameter values."

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

                  上一篇:用于 Visual Studio 2010 错误的 Crystal Reports 下一篇:如何为水晶报表设置数据库登录信息(连接信息)?

                  相关文章

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

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

                    1. <tfoot id='KA1mU'></tfoot>