(I'm having a tough time using this editor -- why can't I paste into it?)
I'm developing a CrystalReportDocument from within Visual Studio for the first time, and cannot get the report to work. My environment is VB.NET in Visual Studio 2013, Crystal Reports for Visual Studio 2013 SP9, and SQL Server Express 2014.
The report Invoice.rpt appears in the Solution Explorer window of my VB.NET project. It uses a SQL Server SP containing one parameter, @RepairOrderNumber, that needs to be supplied at run time. Here's my code that attempts to invoke the report:
Private Sub frmReportViewer_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim rptInvoice As New SD.Invoice ' this is supposed to reference Invoice.rpt
Dim crParameterField As New ParameterField
Dim crParameterFields As New ParameterFields
Dim crParameterDiscreteValue As New ParameterDiscreteValue
crParameterField.Name = "@RepairOrderNumber"
crParameterDiscreteValue.Value = 2 ' hard-coded for now to print invoice number 2
crViewer.ParameterField.Info = crParameterFields
crViewer.ReportSource = rptInvoice
Catch ex As Exception
' error logging code omitted, but no errors were logged.
When I run the above code, the Invoice report is displayed in the viewer, however it's empty -- apparently no result set is being returned. When I preview the report in the designer and supply a parameter value when prompted, the report displays perfectly.
What's wrong with the above code?
Thanks in advance...