Logo 
Search:

Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds

Crystal Report Viewer ERROR

  Asked By: Rainhard    Date: Sep 01    Category: Asp.net    Views: 1105
  

I am trying to view report in ASP.NET with crystal report viewer.
This report has one parameter field.
This is where the problem is...if try to view a a simple report with
no parameter field it works.
But a report with parameter fields does not work.I also tried running
the crystal sample application and to my surprise that one too fails
with same exception.


CrystalDecisions.CrystalReports.Engine.InvalidArgumentException: Error
in File C:\Documents and Settings\talsanir\My
Documents\Application\EmploymentApplicationtest.rpt: Invalid table
number.

It fails at : CrystalReportViewer1.ReportSource = ("C:\\Documents and
Settings\\talsanir\\My
Documents\\Application\\EmploymentApplicationtest.rpt")


following is the code to view report and also to gather parameters:

''The viewer's reportsource must be set to a report before any
''parameter fields can be accessed.
CrystalReportViewer1.ReportSource = ("C:\\Documents and
Settings\\talsanir\\My
Documents\\Application\\EmploymentApplicationtest.rpt")

''Get the collection of parameters from the report
crParameterFields = CrystalReportViewer1.ParameterFieldInfo

''Access the specified parameter from the collection
crParameterField = crParameterFields.Item("AuthID")

''Get the current values from the parameter field. At this
point
''there are zero values set.
crParameterValues = crParameterField.CurrentValues

''Set the current values for the parameter field
crParameterDiscreteValue = New ParameterDiscreteValue()
crParameterDiscreteValue.Value = 254

''Add the first current value for the parameter field
crParameterValues.Add(crParameterDiscreteValue)

''Since this parameter allows multiple values, the discrete
value
''object needs to be reset. Destroy the previous instance and
create
''a new instance.
crParameterDiscreteValue = Nothing
crParameterDiscreteValue = New ParameterDiscreteValue()
crParameterDiscreteValue.Value = 252

''Add the second current value for the parameter field
crParameterValues.Add(crParameterDiscreteValue)

''Set the modified parameters collection back to the viewer so
that
''the new parameter information can be used for the report.
CrystalReportViewer1.ParameterFieldInfo = crParameterFields
CrystalReportViewer1.DataBind()

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Crystal Report Viewer ERROR Or get search suggestion and latest updates.




Tagged: