Click here to Skip to main content
14,091,011 members
Rate this:
Please Sign up or sign in to vote.
Crystal Report Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))
I have made a crystal report in for web application. Some report open nicely. But sometimes it does not. It shows the following problem.
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:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[COMException (0x8002000b): Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))]
Report_Viewer.Page_Load(Object sender, EventArgs e) +894
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927
VS: VS 2008
Database:MS SQL Express 2005
OS:Windows 7
Is there any one to solve my problem..
Thanks in advance

NB: My code is
In a Class------------------------------
public ReportDocument ShowReport(string ReportName, string Parameter1)

cryRpt.SetDatabaseLogon(UserName, Password, ServerName, DatabaseName);
crParameterDiscreteValue.Value = Parameter1;// as like Parameter1
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["@Parameter1"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
catch (Exception ex)
throw ex;
return cryRpt;
Report Viewer Page load ------------------------------
protected void Page_Load(object sender, EventArgs e)

string ReportName="";
string Parameter1="";

ReportName= Session["ReportName "].ToString();
Parameter1 = Session["Parameter1"].ToString();
if (Session["Parameter2"].ToString() != null)
Parameter2 = Session["Parameter2"].ToString();
icount = icount + 1;
catch (Exception ) { }

ReportViewer oReportViewer = new ReportViewer(); // Class file
ReportDocument rptDoc = new ReportDocument();
rptDoc = oReportViewer.ShowReport(ReportName, Parameter1);

rptDoc = oReportViewer.ShowReport(ReportName, Parameter1,
rptDoc.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, "Report");
CrystalReportViewer1.ReportSource = rptDoc;

catch (Exception ex)
throw ex;
Updated 15-Jul-11 20:16pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This error occurs when your parameters not matched in both reports & coding. May be your parameter name is wrong. So verify the parameters & parameter names are same in report & your coding.

Crystal Report Viewer Error in ASP.Net 2005[^]
Member 11572517 20-Sep-16 12:43pm
thank u sir/ma'm, u r right.i got same error and it's solve it.
thatraja 21-Sep-16 0:26am
Glad, it helped you even though that's 5 year old answer.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Try This
        If TextBox1.Text <> "" Then
            cryReport.RecordSelectionFormula = "{Customer.CustomerID} = " & TextBox1.Text
        End If

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web06 | 2.8.190518.1 | Last Updated 11 Dec 2014
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100