<bdo id='OCiCb'></bdo><ul id='OCiCb'></ul>
  • <small id='OCiCb'></small><noframes id='OCiCb'>

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

      <tfoot id='OCiCb'></tfoot>
      <i id='OCiCb'><tr id='OCiCb'><dt id='OCiCb'><q id='OCiCb'><span id='OCiCb'><b id='OCiCb'><form id='OCiCb'><ins id='OCiCb'></ins><ul id='OCiCb'></ul><sub id='OCiCb'></sub></form><legend id='OCiCb'></legend><bdo id='OCiCb'><pre id='OCiCb'><center id='OCiCb'></center></pre></bdo></b><th id='OCiCb'></th></span></q></dt></tr></i><div id='OCiCb'><tfoot id='OCiCb'></tfoot><dl id='OCiCb'><fieldset id='OCiCb'></fieldset></dl></div>
      1. 使用 datetimepicker 过滤水晶报表中的数据

        Filter data in crystal report using datetimepicker(使用 datetimepicker 过滤水晶报表中的数据)
        <i id='fyh90'><tr id='fyh90'><dt id='fyh90'><q id='fyh90'><span id='fyh90'><b id='fyh90'><form id='fyh90'><ins id='fyh90'></ins><ul id='fyh90'></ul><sub id='fyh90'></sub></form><legend id='fyh90'></legend><bdo id='fyh90'><pre id='fyh90'><center id='fyh90'></center></pre></bdo></b><th id='fyh90'></th></span></q></dt></tr></i><div id='fyh90'><tfoot id='fyh90'></tfoot><dl id='fyh90'><fieldset id='fyh90'></fieldset></dl></div>
        <legend id='fyh90'><style id='fyh90'><dir id='fyh90'><q id='fyh90'></q></dir></style></legend>
        <tfoot id='fyh90'></tfoot>
                <bdo id='fyh90'></bdo><ul id='fyh90'></ul>

                    <tbody id='fyh90'></tbody>
                1. <small id='fyh90'></small><noframes id='fyh90'>

                2. 本文介绍了使用 datetimepicker 过滤水晶报表中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在 Crystal Reports C# windows 应用程序中处理报表.我从 localhost 服务器获取数据到 Crystal 报表.我的表单中有 2 个 datetimepicker.

                  I'm working on a report in Crystal Reports C# windows application.i fetch the data from localhost server to crystal report. I have 2 datetimepicker in my form.

                  datetimepicker1 = dtpfrom

                  datetimepicker1 = dtpfrom

                  datetimepicker2 - dtpto

                  datetimepicker2 - dtpto

                  水晶报告

                  现在我想要那个,当在 from 和 to datetimepicker 中选择某个日期时,数据之间的数据显示在水晶报告中,请帮助我解决我不知道如何开始的问题.我正在通过谷歌搜索我没有得到关于水晶报告中 datetimepicker 显示的数据之间的任何信息.有什么想法吗?

                  Now I want that, when selecting some date in from and the to datetimepicker the between data is show in the crystal report please help me to solve i don't know how to start. i'm searching through googling i didn't get any thing about between data in datetimepicker show in crystal report. Any ideas?

                  这是我的尝试:

                  MySqlConnection conn = new MySqlConnection(MyCon);
                              CrystalReport1 objcr = new CrystalReport1();
                              MySqlDataAdapter da = new MySqlDataAdapter("select * from data where date>='" + DateTime.Parse(dtpfrom.Text) + "' and date<='" + DateTime.Parse(dtpto.Text) + "' ", conn);
                              DataTable dt = new DataTable();
                              da.Fill(dt);
                              objcr.SetDataSource(dt);
                              crystalReportViewer1.ReportSource = objcr;
                              crystalReportViewer1.RefreshReport();
                  

                  但我遇到了错误

                  未处理的类型异常'CrystalDecisions.CrystalReports.Engine.DataSourceException' 发生在 CrystalDecisions.ReportAppServer.DataSetConversion.dll 中

                  An unhandled exception of type 'CrystalDecisions.CrystalReports.Engine.DataSourceException' occurred in CrystalDecisions.ReportAppServer.DataSetConversion.dll

                  附加信息:加载数据库信息失败.

                  Additional information: Failed to load database information.

                  在线:

                  objcr.SetDataSource(dt);
                  

                  推荐答案

                  @divi

                  使用 datetimepicker 过滤报告中的数据不是为您的编码完成的

                  filter data in report using datetimepicker is not done for your coding

                  执行以下操作:

                  在字段资源管理器中创建一个新参数fromdate,todate -> 参数字段(右键单击)-> 新建

                  create a new parameter fromdate, todate in Field Explorer -> Parameter Field(Right Click)-> New

                  像这样也使今天成为今天

                  like this make todate also

                  然后右键单击报告.

                  选择报表 -> 选择公式 -> 记录...

                  Select Report -> Selection Formula -> Record...

                  关注

                  然后单击该表单中的保存并关闭按钮.

                  then click save and close button in that form.

                  知道这一点:

                  右击报表 -> 数据库 -> 设置数据源位置...

                  Right Click the report -> Database -> Set Datasource Location...

                  现在编码

                   ReportDocument report = new ReportDocument();
                              report.Load("C:\Users\Desktop\CrystalReport1.rpt");
                  
                              TableLogOnInfo Table = new TableLogOnInfo();
                              ConnectionInfo Connection = new ConnectionInfo();
                              Tables Tables;
                  
                              ParameterFieldDefinitions Parameters;
                              ParameterFieldDefinition Parameter;
                              ParameterValues Values = new ParameterValues();
                              ParameterDiscreteValue DiscreteValue = new ParameterDiscreteValue();
                  
                              DiscreteValue.Value = dateTimePicker1.Text;
                              Parameters = report.DataDefinition.ParameterFields;
                              Parameter = Parameters["fromdate"];
                              Values = Parameter.CurrentValues;
                  
                              Values.Clear();
                              Values.Add(DiscreteValue);
                              Parameter.ApplyCurrentValues(Values);
                  
                              DiscreteValue.Value = dateTimePicker2.Text;
                              Parameters = report.DataDefinition.ParameterFields;
                              Parameter = Parameters["todate"];
                              Values = Parameter.CurrentValues;
                  
                              Values.Add(DiscreteValue);
                              Parameter.ApplyCurrentValues(Values);
                  
                              Connection.ServerName = "Your servername in Set Datasource Location";
                              Connection.DatabaseName = "Your databasename in Set Datasource Location";
                              Connection.UserID = "your username";
                              Connection.Password = "your password";
                  
                              Tables = report.Database.Tables;
                              foreach (CrystalDecisions.CrystalReports.Engine.Table table in Tables)
                              {
                                  Table = table.LogOnInfo;
                                  Table.ConnectionInfo = Connection;
                                  table.ApplyLogOnInfo(Table);
                              }
                  
                              crystalReportViewer1.ReportSource = report;
                              crystalReportViewer1.Refresh();
                  

                  希望这有助于解决您的问题.

                  Hope This helps to solve your problem.

                  这篇关于使用 datetimepicker 过滤水晶报表中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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# - 按属性获取所有枚举值)

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

                          <small id='7FpMj'></small><noframes id='7FpMj'>