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

    Question

  • Any ideas why I am getting COMException when I was expecting and handling an exception of type

    CrystalDecisions.CrystalReports.Engine.InvalidArgumentException

    Why are those nasty interop exceptions showing up ?

    Thanks

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

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Runtime.InteropServices.COMException: Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))

    Source Error:
    Friday, October 07, 2005 4:39 PM

Answers

  • Hello,

    This is definitely a usability issue.  I will track it with our development team and they will have to address it in a future release or service pack.

    Keith - Business Objects
    Tuesday, November 08, 2005 8:59 PM

All replies

  • Hello,

    Do you happen to know the line of code it is throwing the error on?

    Keith - Business Objects
    • Proposed as answer by kpl.sharma Thursday, October 30, 2008 7:03 PM
    Wednesday, October 12, 2005 11:12 PM
  • The code that is triggering the exception is the try catch block

    private static void AllowPageBreaks(ReportDocument rpt, bool allow) {

    try{

    AddReportParameter(rpt,"NoPageBreaks",!allow);

    }

    catch(CrystalDecisions.CrystalReports.Engine.InvalidArgumentException) {

    // Do nothing, we don't mind if the report definition doesn't have

    // the NoPageBreaks parameter

    }

    catch(Exception e) {

    throw e;

    }

    }

    public static void AddReportParameter(ReportDocument rpt, string ParameterName, object val){

    ParameterValues prms;

    ParameterDiscreteValue prm = new ParameterDiscreteValue();

    prms = rpt.DataDefinition.ParameterFields[ParameterName].CurrentValues;

    prm.Value = val;

    prms.Add(prm);

    rpt.DataDefinition.ParameterFields[ParameterName].ApplyCurrentValues(prms);

    }


    Pl don't tell me I have to handle COM exceptions. When a report parameter doesn't exist, throw some managed exception.


    Thanks

    Thursday, October 13, 2005 2:17 PM
  • Hello,

    This is definitely a usability issue.  I will track it with our development team and they will have to address it in a future release or service pack.

    Keith - Business Objects
    Tuesday, November 08, 2005 8:59 PM
  • I am getting this same error when trying to load a report and subreport into a CR viewer in VB.NET 2005.  Is this still a "usability" issue...(that's a new one on me, I guess that means it doesn't work)?  Is there a patch?  Thanks.
    Friday, May 26, 2006 7:44 PM
  • Even I am getting the same error.

    Crystal report is taking all the values except datetime.

    In report I want to show  data based on advanced search.

    So when I am entering year info ( ie. data from 2002 to 2005) ,it throws an error.

    How can I match the data types?

    Thanks,

    Kalpna

    Thursday, August 03, 2006 2:34 PM
  • Hi Kalnapa,

    Did you manage to figure out why you are getting this error. Infact, i'm also getting an error, whereas my report was working perfectly alright with .net 1.1 and when I migrated to .net 2.0 I'm getting this issue. If you manage to figure out, please share with me.

    email: mdyameen6 at rediffmail dotcom (I really hope you'll get it right) :-)

    Regards
    Yameen

    Wednesday, August 09, 2006 10:30 AM
  • Did anyone ever resolve  this? I have the same problem. My problem occurs on this line

    reportDoc.SetParameterValue("@Department", _orderSearchOptions.DepartmentName);

    DepartmentName is simply a string. The problem occurs whether the string is empty or not. This is strange because I can set other parameters with no problems.

    Thanks

    Jon

    Tuesday, November 28, 2006 10:55 AM
  • Stupid stupid me. When I double checked that the parameter names were correct I realised...yep you guessed i, they weren't

    So to anyone else out there, if you are having this problem, first check the names are the same.

    Jon

    • Proposed as answer by kehaley Wednesday, July 08, 2009 6:38 PM
    Tuesday, November 28, 2006 10:59 AM
  • Hi,

    i m getting an error when i assign printer's papersource value, see below code

    objReport.PrintOptions.PaperSource = CrystalDecisions.[Shared].PaperSource.Cassette

    its throwing the same error. this was working fine with framework 1.1

    but after i installed framework 2.0 i m getting this error.

    i m using crystal reports XI release 2, visual studio 2005

    the papersource is accepting only auto

    objReport.PrintOptions.PaperSource = CrystalDecisions.[Shared].PaperSource.Auto

    other than auto it s not accepting any other value

    Is this a problem with framework 2.0 or crystal reports?

    URGENT..

     

    Tuesday, January 16, 2007 12:41 PM
  • Yeah, stupid me too. I had the same problem as levyuk1. Thanks for your post - that's what made me double-check the parameters.
    Wednesday, February 28, 2007 4:11 PM
  • Hi all

    error given below may occurs due to invalid argument passing

    like space in double quots.

     

    Thursday, May 10, 2007 2:22 PM
  • Hi All

    error of such type may occure due to invalid arg. pass to the

    crystal report so crystal report throws such type of error

    as example "@clientID " here parameter passing to report

    is correct but it contains space at the end.

    Thursday, May 10, 2007 2:25 PM
  • I am getting the same error in Outlook when I double click a message in the Navigation Pane.  Any help would be appreciated.

     

     

    Thursday, June 14, 2007 2:05 AM
  •  

    Hi All -

     

    The field names in Crystal Reports are case-sensitive.

     

    Be sure to check that the spelling is exactly the same, including case, when passing your parameters.

     

    Good Luck,

     

    -Mark

    Monday, July 02, 2007 4:47 PM
  • Also,verify the database of the crystal report.

     

    Monday, August 06, 2007 6:32 PM
  • Wednesday, October 24, 2007 6:48 PM
  • I might be late but here's what i've discovered to resolve the same error i encountered. 

     

    i created my crystal report in version XI.  i opened it in VB 2005 and added a new formula field.  i saved it in VB and made the codes to pass the formula field value.  i encountered the same frustrating error no matter how i restructured my passing of formulas and even parameter fields.

     

    it's almost late when i found out that my added new formula field was not really saved inside VB 2005.  i opened it using my installed Crystal XI environment and there was no new formula field.  i then added the field, saved and ran it in VB...

     

    guess what?  i took my dinner atlast!!! ;-) surely this may help.

    Tuesday, February 05, 2008 11:55 AM
  • I was getting same Error  when i migrate from 2003 to 2005 :
    (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))

    Dim report As New ReportDocument
    'Make report
    report.SetParameters("@param", obj) <-- This line throws the error
    CrystalReportViewer.ReportSource = report
    CrystalReportViewer.DataBind()

    Later after a small research i come to know that it was a usiblity issue. To resolve this Issue Download Crystal report patch

    http://support.businessobjects.com/downloads/service_packs/crystal_reports_en.asp#NET2005

    I will work without changing any code! 



    Monday, March 17, 2008 11:44 AM
  • Hi

    Sohail,

     

    Thanks for your solution for the error.

     

    I have download and applied the patch from the link given by u and appled,and the error solved.I did that in development environmet.

    Now my question is that that does that patch need to be applied on production environment?

     

    i.e if I am going to bulid my installer will I have to apply or add that patch in the installer also?

     

    Pls reply .

     

    Thanks.

    Subhendu

    Thursday, April 24, 2008 1:14 PM
  • No.

    Thursday, April 24, 2008 3:20 PM
  • I had the same problem and it turns out I was specifying a parameter value in code that didn't exist in the report (but should have and used to... not sure why it disappeared).

    Crystal Reports really should give an error like "Parameter SuchAndSuch Is Not Defined".
    Wednesday, May 28, 2008 7:51 PM
  • try this way, the problem will be resolved.

     when ever you change anything into the code you have to refresh the connection into report. 

    Eshwar
    Tuesday, June 24, 2008 6:08 AM
  •  Hi,
    I am having the same problem in crystal report "bad index". I have tried almost everything but nothing works. The only thing left is downloading patch for crystal report. I am trying to go to the link provided by you but it is not there. Could you please tell me from where I can download the patch for crystal report for .net.

    Thank you
    Monday, August 04, 2008 11:51 PM
  • Hi ,

    I am not able to download the patch from this site.

    Thursday, October 30, 2008 7:03 PM
  • Hi,

    I am facing the problem while setting the report parameter. Can you please suggest me the reason and solution.

    I am using Crystal report  XI enterpise
    Using Visual Studio 2005-08 ( both)

    Code Lines :

    myReportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument()

    Try

    With myReportDocument

    'Set report parameters

    .SetParameterValue("StartDt", objSearch.StartDate)  --- Error from this line

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

    Thanks

    Thursday, October 30, 2008 7:22 PM
  • I am getting this error when I try and add the parameter. I successfully added two parameters 

    crRpt.SetParameterValue("Start_Date", "02/01/2009");
    crRpt.SetParameterValue(
    "End_Date", "02/10/2009");


    and then used the exact same code and tried to add one


    crRpt.SetParameterValue("DOC_ID", "1010");


    I got through that line when I changed the code to read


    crRpt.SetParameterValue("@DOC_ID", "1010");


    This doesn't make alot of sense- but it did make the code work.


    Dr Suess
    • Proposed as answer by WafaKhan Wednesday, March 31, 2010 7:01 AM
    Monday, February 16, 2009 10:02 PM
  • hi , 
     
    i not used any parameters , but i got the same error 
    "Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))"

     this is my code 

                      CrystalDecisions.CrystalReports.Engine.ReportDocument rptdoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
                    rptdoc.Load(Application.StartupPath + "\\Reports\\Remit.rpt");
                    rptdoc.SetDataSource(dsReportSource);
                    rptdoc.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperLetter;          ---Error throw on this line 
                    rptdoc.PrintOptions.PrinterName = obj.PrinterSettings.PrinterName;
                    rptdoc.PrintToPrinter(1, obj.PrinterSettings.Collate, obj.PrinterSettings.FromPage, obj.PrinterSettings.ToPage);

       rptdoc.Close();
                rptdoc.Dispose();
                rptdoc = null;
                GC.Collect();
                GC.WaitForPendingFinalizers();

    one more thing i wish to inform you is, the error was not thrown all the time. 
    for ex: i called this code for three time it throws the error only at second time (it works fine on first and third time)

    please update me what i did wrong 


    annamalai
    Wednesday, April 22, 2009 12:20 PM
  • I get this when I try to run my report in my web application

    Detailed error information follows: Date and Time: 5/20/2009 1:44:10 PM Machine
    Name: CUFWEB03 Process User: NT AUTHORITY\NETWORK SERVICE
    Remote User: CUFIS\swmayhew Remote Address: 10.100.50.141
    Remote Host: 10.100.50.141 URL: http://cufweb03/AdvanceWeb9300/ReportCrystalViewer.aspx?SelectedReport=AvUhTynJx7n1lAox123E3g%3d%3d

    NET Runtime version: 2.0.50727.42 Application Domain: /LM/W3SVC/1/root/AdvanceWeb9300-1-128873098214506042 Assembly Codebase: C:/WINDOWS/assembly/GAC/CrystalDecisions.ReportAppServer.DataDefModel/11.5.3300.0__692fbea5521e1304/CrystalDecisions.ReportAppServer.DataDefModel.dll Assembly Full Name: CrystalDecisions.ReportAppServer.DataDefModel, Version=11.5.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304 Assembly Version: 11.5.3300.0 Assembly Build Date: 4/14/2009 7:57:38 AM Exception Type: System.Runtime.InteropServices.COMException Exception Message: Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX)) Exception Source: CrystalDecisions.ReportAppServer.DataDefModel Exception Target Site: get_Item

    Is this date related?
    Thanks
    Wednesday, May 20, 2009 7:53 PM
  • hi swm ,


     my kind advice is to confirm all the fields used in report are available in your datasource ,

    if yes, then reconfirm all the fields in datasource were not misspelled (including case sensitive),

    hope ,

    it will solve the problem :)




    annamalai
    Thursday, May 21, 2009 5:08 AM
  • I have same error message and that was because I was using in grogram parameter name as "@wonum"  but in Crystal
    parameter name was "wonum".

    Thank you
    • Proposed as answer by ddg1330 Monday, November 16, 2009 1:55 PM
    Tuesday, July 21, 2009 3:56 PM
  • make sure there are NO SPACES in you build string for numeric parameters:

    sql =

    "Start Date= " & Me.DateTimePicker1.Value & " & AvgPrice= " & Me.txt_Field1.Text
    will not work

    sql =

    "Start Date= " & Me.DateTimePicker1.Value & " &AvgPrice=" & Me.txt_Field1.Text
    works

    Monday, November 16, 2009 1:57 PM
  • Check the Report Path  i had the same problem ,  when i verify the report path it was not correct , when i correct that noe its working properly


    Prabakar
    Wednesday, March 24, 2010 4:31 PM
  • THanks, That solved the problem for me :)
    Friday, September 17, 2010 8:18 AM
  • Any ideas why I am getting COMException when I was expecting and handling an exception of type

    CrystalDecisions.CrystalReports.Engine. InvalidArgumentException

    Why are those nasty interop exceptions showing up ?

    Thanks

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

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Runtime.InteropServices.COMException: Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))

    Source Error:


    I was getting the same error .. but that was my stupidity.

    the matter was of wrong name of parameter.do check them

    Saturday, October 09, 2010 6:38 AM
  • Same for me, lack of a parameter
    Sunday, November 07, 2010 4:51 PM
  • I just had the same problem.

    The mistake i made was not copying the Crystal Report from the main folder into the debug folder after i made changes to it!

    Just copy Save your report, Go into the save directory and copy the report to the debug and/or Release folder.

    Good luck!

    Sunday, November 07, 2010 10:33 PM
  • hi,

    i am facing the similar problem, did you manage to resoove it?

    Umer Hayat

    Monday, March 28, 2011 8:55 AM
  • hi askitana!

    i am facing the similar problem please help me if you have solution

    Umer Hayat

    Monday, March 28, 2011 9:19 AM
  • Hi Umer Hayat,

     

    Most of us got this error because of missing some fields in the report data source

    So please verify whether the fieldname misspelled in Datasource comparing to the fields in report.

    if any parameters or formula used in the report, please also verify that too....

     

    All the best!!!

     

     


    annamalai
    • Proposed as answer by askitanna Tuesday, March 29, 2011 10:22 AM
    Tuesday, March 29, 2011 8:58 AM
  • Hi askitanna!
    Thank you very much, exactly it is, i didn't consider this as a cause of such error, because it was running fine on window 7 and causing problem on client pc.

    Regards.


    .
    Tuesday, March 29, 2011 9:22 AM