Skip to Content
0
Former Member
Apr 11, 2013 at 03:06 PM

Crystal Reports Runtime Engine ignores Parameter Values

322 Views

My configuration:

Visual Studio 2010 (10.0.30319.10)

SAP Crystal Reports devleoper version for Microsoft Visual Studio (CRforVS_13_0_5.exe)

SAP Crystal Reports runtime engine for .NET Framework (CRRuntime_32bit_13_0_5.msi)

Microsoft .NET Framework 4.0.30319

Window XP Service Pack 3

Crystal Reports Developer, Type: Full, Version 11.0.0.895 (this is not installed on my XP machine. I use this on another machine to create reports)

Apps: Written in VB.NET, using Crystal Reports Viewer Control

Crystal Reports References in VB.NET Solution: SAPBusinessObjects.WPF.Viewer, SAPBusinessObjects.WPF.ViewerShared, CrystalDecisions.CrystalReports.Engine, CrystalDecisions.ReportSource, CrystalDecisions.Shared, CrystalDecisions.Windows.Forms

Issue: .rpt Crystal Report files launched from VB.NET app using the Crystal Reports Viewer Control not prompting for Parameter Values in some cases, and when it does prompt for Parameter Values, they are ignored by the report (ie: No filtering is occurring in the report. It returns all rows in the table(s)). If I launch the same .rpt file via the Crystal Reports Full Version, all prompts are displayed, filtering occurs, and the correct output is displayed on the report.

Here is what I have discovered with my testing: When a .rpt file is launched from VB.NET (ie: using Crystal Reports runtime), if a Parameter field is not added to one of the report output sections (Report Header/Footer, Page Header/Footer, Details), then a prompt is not displayed for that Parameter (reminder: when run via the Full Version of Crystal Reports, the prompt does display, and the report uses the value to filter the data). So, just to force the runtime to display the prompt, I add the Parameter field to one of the report output sections, but then the report just ignores the value (ie: no filtering occurs, all rows from the table are read and displayed).

My VB.NET Code:

Dim Report As New ReportDocument()

Report.Load(mReportName)

For Each ReportTables In Report.Database.Tables

 ReportTableCurrent = ReportTables.LogOnInfo

 With ReportTableCurrent.ConnectionInfo

 .ServerName - ODBCDSN

 .UserID = mUserName

 .Password = mPassword

 End With

 ReportTables.ApplyLogOnInfo(ReportTableCurrent)

Next ReportTables

CrystalReportViewer.Refresh()

CrystalReportViewer.ReportSource = Report

.

.

.

mFrmUDACrystalViewer.Show()