Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将dateTimePicker值传递给c#中的Crystal Report?_C#_Crystal Reports - Fatal编程技术网

如何将dateTimePicker值传递给c#中的Crystal Report?

如何将dateTimePicker值传递给c#中的Crystal Report?,c#,crystal-reports,C#,Crystal Reports,我想将datetimepicker值传递给Crystal report,以显示这些日期之间的行 我正在使用这个代码 private void button3_Click(object sender, EventArgs e) { DateTime d1 = Convert.ToDateTime(this.dateTimePicker1.Value.ToShortDateString()); DateTime d2 = Convert.ToDateTime

我想将datetimepicker值传递给Crystal report,以显示这些日期之间的行 我正在使用这个代码

 private void button3_Click(object sender, EventArgs e)
    {
        DateTime d1 = Convert.ToDateTime(this.dateTimePicker1.Value.ToShortDateString());
        DateTime d2 = Convert.ToDateTime(this.dateTimePicker2.Value.ToShortDateString());
        RPT.rpt_all_bocket_transaction myReport = new RPT.rpt_all_bocket_transaction();
        myReport.SetParameterValue("@D1",d1);
        myReport.SetParameterValue("@D2",d2);
        RPT.frm_rpt myForm = new RPT.frm_rpt();
        myForm.crystalReportViewer1.ReportSource = myReport;
        myForm.ShowDialog();
    }
我的存储过程在没有crystal report的情况下工作正常 但是当我试图在两个日期之间搜索时,我得到了这个错误

Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))

您的代码很好,可以正常工作。确保在代码中调用了正确的报告

RPT.rpt_all_bocket_transaction
确保检查您的报告是否与正确的程序连接。
我看不到您的代码中有任何其他错误。

无效索引意味着可能没有使用“@D1”或“@D2”键定义参数……存储过程中的参数是:“@D1 datetime,@D2 datetime”可能与我的存储过程重复是对的,但我调用了另一个非参数报表,谢谢
RPT.rpt_all_bocket_transaction