How to pass dateTimePicker Value to Crystal Report in c#?

2

I am want to pass datetimepicker Value to Crystal report to show rows Between those date i am using this code

 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();
    }

my stored Proceduer work fine without crystal report but when i trying to search between two date i get this error

Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))
c#
crystal-reports
asked on Stack Overflow Jan 10, 2017 by Amal Ahmed

1 Answer

1

Your code is fine and works. Make sure you are calling the correct report in your code.

RPT.rpt_all_bocket_transaction

Make sure to check your report is connected with the correct procedure. I don't see any other mistakes in your code.

answered on Stack Overflow Jan 10, 2017 by Mohamed Hmmam • edited Jan 10, 2017 by DDelgro

User contributions licensed under CC BY-SA 3.0