How to solve Crystal report Error as "Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))"?

1

Hai i got error in wpf crystalreports while loading with dateparameters as "Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))",how to solve this?

            string dfrm1 = "";
            string dto1 = "";
            DateTime dateTime1a = datePicker1.SelectedDate.Value;
            dfrm1 = string.Format("{0} {1}:{2}:{3}", dateTime1a.ToShortDateString(), 00, 00, 01);
            DateTime dateTime2a = datePicker2.SelectedDate.Value;
            dto1 = string.Format("{0} {1}:{2}:{3}", dateTime2a.ToShortDateString(), 23, 59, 59);
            SqlConnection con = new SqlConnection(constring);
            con.Open();
            adp = new SqlDataAdapter("SELECT PatientID, PatientName],Blood_Group,City,Date FROM PatientTable Where Date Between'" + dfrm1 + "' and '" + dto1 + "'", con);
            adp.Fill(ds);
            string loc2 = AppDomain.CurrentDomain.BaseDirectory;
            orpt.Load(loc2 + "CrystalReport2.rpt");
            orpt.SetDataSource(ds.Tables[0]);
            orpt.SetParameterValue(0, dfrm1);//This line showing error as "Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))"
            orpt.SetParameterValue(1, dto1);
            rtg.crystalReportsViewer1.ViewerCore.ReportSource = orpt;
c#
wpf
crystal-reports
crystal-reports-2010
asked on Stack Overflow May 21, 2015 by Ramji21

1 Answer

0

I had this error, what I did was:

  1. Update Entities Model (*.edmx);
  2. Update my DataSet (*.xsd);
  3. Update the report DataBase Expert.

it worked for me.

answered on Stack Overflow Jul 16, 2018 by Chuze • edited Jul 16, 2018 by Pang

User contributions licensed under CC BY-SA 3.0