kalai selvan

kalai selvan

  • NA
  • 3
  • 7.6k

Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_B

May 8 2013 1:33 AM

Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX)) (rpt.SetParameterValue("@F_DATE", "Test"))
 
When i pass Parameter values not show the report 
Imports System.IO
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.HttpApplication
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports CrystalDecisions.Web
Imports CrystalDecisions.ReportSource
Partial Class Reportviewer
Inherits System.Web.UI.Page
Public str As String
Public rptname As String
Public sf As String
Private rpt1 As CrystalDecisions.CrystalReports.Engine.ReportDocument
 
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim con As New ConnectionInfo
Dim con1 As New ConnectionInfo
Dim db1 As Database
Dim dbs As Tables
Dim db As Table
Dim tab As TableLogOnInfo
rptname = Session("rptname") 
If rptname = "" Then
Exit Sub
End If
str = Convert.ToString(Session("Str")) '" {INV_HEAD.HInv_NO}='0000000001' "
Dim rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument
With con
.UserID = "sa"
.Password = "sa"
.DatabaseName = "tes"
' .ServerName = "Develope-PC"
.ServerName = "server"
End With
rpt.Load(Server.MapPath("..\Report\INV_LIST1.rpt"))

db1 = rpt.Database
dbs = db1.Tables
For Each db In dbs
tab = db.LogOnInfo
tab.ConnectionInfo = con
db.ApplyLogOnInfo(tab)
Next
CrystalReportViewer1.SelectionFormula = str
CrystalReportViewer1.ReportSource = rpt
'''''''''''''''''''''''''''
 
'this is my error line 
rpt.SetParameterValue("@F_DATE", "Test")
 

'''''''''''''''''''''
CrystalReportViewer1.ShowFirstPage()
CrystalReportViewer1.RefreshReport()
 

 
End Sub
 

 

End Class
 

 

 

 

 

error mage 
 
Server Error in '/e-Tasheel' Application.
 
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: 
 

Line 15: crParameterDiscreteValue.Value = "@F_DATE"
Line 16: crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields()
Line 17: crParameterFieldDefinition = crParameterFieldDefinitions.Item("@F_DATE")
Line 18: crParameterValues = crParameterFieldDefinition.CurrentValues
Line 19: 
 
Source File: C:\Users\surya\Desktop\Amjidh\e-Tasheel\Report\Default.aspx.vb Line: 17 
 
Stack Trace: 
 

[COMException (0x8002000b): Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))]
CrystalDecisions.ReportAppServer.DataDefModel.FieldsClass.get_Item(Int32 Index) +0
CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinitions.get_Item(Int32 index) +81
CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinitions.get_Item(String fieldName) +105
Report_Default.Page_Load(Object sender, EventArgs e) in C:\Users\surya\Desktop\Amjidh\e-Tasheel\Report\Default.aspx.vb:17
System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207
 
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1