• <tfoot id='3sTWl'></tfoot>

    • <bdo id='3sTWl'></bdo><ul id='3sTWl'></ul>

    <legend id='3sTWl'><style id='3sTWl'><dir id='3sTWl'><q id='3sTWl'></q></dir></style></legend>

      <small id='3sTWl'></small><noframes id='3sTWl'>

      <i id='3sTWl'><tr id='3sTWl'><dt id='3sTWl'><q id='3sTWl'><span id='3sTWl'><b id='3sTWl'><form id='3sTWl'><ins id='3sTWl'></ins><ul id='3sTWl'></ul><sub id='3sTWl'></sub></form><legend id='3sTWl'></legend><bdo id='3sTWl'><pre id='3sTWl'><center id='3sTWl'></center></pre></bdo></b><th id='3sTWl'></th></span></q></dt></tr></i><div id='3sTWl'><tfoot id='3sTWl'></tfoot><dl id='3sTWl'><fieldset id='3sTWl'></fieldset></dl></div>
      1. 在 C# 中将参数传递给水晶报表的步骤

        Steps to Pass parameters to crystal reports in C#(在 C# 中将参数传递给水晶报表的步骤)
        • <small id='C50nf'></small><noframes id='C50nf'>

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

                <tbody id='C50nf'></tbody>
            1. <tfoot id='C50nf'></tfoot>

                <i id='C50nf'><tr id='C50nf'><dt id='C50nf'><q id='C50nf'><span id='C50nf'><b id='C50nf'><form id='C50nf'><ins id='C50nf'></ins><ul id='C50nf'></ul><sub id='C50nf'></sub></form><legend id='C50nf'></legend><bdo id='C50nf'><pre id='C50nf'><center id='C50nf'></center></pre></bdo></b><th id='C50nf'></th></span></q></dt></tr></i><div id='C50nf'><tfoot id='C50nf'></tfoot><dl id='C50nf'><fieldset id='C50nf'></fieldset></dl></div>
                  <bdo id='C50nf'></bdo><ul id='C50nf'></ul>
                • 本文介绍了在 C# 中将参数传递给水晶报表的步骤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  你能告诉我将参数传递给C#win形式的水晶报表13的步骤是什么吗..

                  Can you tell me what are the steps to pass parameters to crystal reports 13 in C# win form..

                  我的代码:

                          //getting and set dataset to report   
                          string sql = "select * from dbo.Trading_Order";
                          DataRetriever dr = new DataRetriever();
                          dr.getValueFromCustomer(sql);
                          DataTable dtSum = dr.getDataTable();
                          dsMyReprt k = new dsMyReprt();
                          k.Tables.Remove("dtMyTable");
                          dtSum.TableName = "dtMyTable";
                          k.Tables.Add(dtSum);
                          CrystalReport1 myDataReport = new CrystalReport1();
                  
                          //pass parameter
                  
                          ParameterFields paramFields = new ParameterFields();
                          // ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
                  
                          ParameterField paramField = new ParameterField();
                          ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
                          paramField.Name = "@DTotal";
                          paramDiscreteValue.Value = tot;
                          paramField.CurrentValues.Add(paramDiscreteValue);
                          paramFields.Add(paramField);
                  
                          paramField = new ParameterField(); 
                          paramDiscreteValue = new ParameterDiscreteValue(); 
                          paramField.Name = "@name";
                          paramDiscreteValue.Value = name;
                          paramField.CurrentValues.Add(paramDiscreteValue);
                          paramFields.Add(paramField);
                  
                          crystalReportViewer1.ParameterFieldInfo = paramFields;
                  
                          myDataReport.SetDataSource(k);
                          crystalReportViewer1.ReportSource = myDataReport;
                  

                  获取和设置数据集部分正在工作但是传递参数部分不起作用

                  getting and set dataset part is working but passing parameters part is not working

                  推荐答案

                  我为此头疼了好几个星期……我必须准确地说我在 Crystal Reports 设计器中设置了一个 sql 查询.因此,我没有像您那样使用数据表,因此您必须考虑这一点.

                  I got big headaches with that for weeks... I have to precise that I set a sql query in the Crystal Reports Designer. Thus, I didn't use a dataTable like you did, so you have to consider that.

                  好吧,@campagnolo_1 建议你:

                  Well, @campagnolo_1 suggested you :

                  ReportDocument myDataReport = new ReportDocument();
                  myDataReport.Load(@"C:ReportsReport.rpt");
                  
                  myDataReport.SetParameterValue("MyParameter1", "Hello1");
                  myDataReport.SetParameterValue("MyParameter2", "Hello2");
                  myDataReport.SetParameterValue("MyParameter3", "Hello3");
                  

                  这是简短而甜蜜的解决方案.但是,在此之后,您必须确保已在 Crystal Reports 设计器中创建了 String 类型的 MyParameter1MyParameter2MyParameter3.

                  This is the short and sweet solution. But, following this, you have to make sure you have created MyParameter1, MyParameter2 and MyParameter3of type String in the Crystal Reports Designer.

                  1. 需要指出的是,在使用 SetParameterValue 设置参数之前,您必须先加载报告.

                  1. It's important to mention that you have to Load the report before setting your parameters with SetParameterValue.

                  如果你的参数名称是MyParameter1,那么不要在前面添加@这样的:

                  If your parameter's name is MyParameter1, then don't add a @ in front like this :

                  myDataReport.SetParameterValue("@MyParameter1", "Hello1");//你的程序会崩溃.

                  myDataReport.SetParameterValue("@MyParameter1", "Hello1"); // Your program will crash.

                  如果你得到参数不正确那么你应该确保你给出的参数值的类型与参数类型完全一样.例如,如果您有一个参数 StartDate 作为 Date 类型,那么请确保您给出的值是 Date 类型并且具有正确的日期格式.

                  If you got The parameter is incorrect then you should make sure the type of parameter value you gave is exactly the same as the parameter type. For example, if you have a parameter StartDate as type Date, then make sure the value you'll give is of type Date and has the right date format.

                  此外,您还谈到了动态或静态字段.在您的情况下,我认为您手动输入值,那么这是静态字段.

                  Also, you have talked about dynamic or static field. In your case, I think you enter values manually, then this is static field.

                  希望对你有所帮助.

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

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

                  相关文档推荐

                  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# - 按属性获取所有枚举值)
                    <bdo id='Dv5o1'></bdo><ul id='Dv5o1'></ul>

                      <tfoot id='Dv5o1'></tfoot>

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

                            <tbody id='Dv5o1'></tbody>
                          <legend id='Dv5o1'><style id='Dv5o1'><dir id='Dv5o1'><q id='Dv5o1'></q></dir></style></legend>
                          • <small id='Dv5o1'></small><noframes id='Dv5o1'>