It all started last week. I am writing a Windows application with VS 2012. This application has several reports. There is a particular report that has a parameter that I use as the header. In the Form Load event handler of the form that displays the report, I set the parameter with the line rpt.SetParameterValue(0, strHeader), where rpt is the instance of the report, and strHeader holds whatever I want the header to be.
This was working great. Last week I tweaked the report to and a line feed after the text in a field in the dataset. This had nothing to do with the header. After making this change, when I open the form with the report on it, I am prompted to enter the value for the parameter. I can find no reason for this. I put the line that opens the form with the report on it elsewhere in the application, and was not prompted for the parameter value. This is not an acceptable fix, though. I deleted the contents of the bin folder in the project’s folder, but got the same behavior.
I tried writing a simple application to explore different ways of setting the header. I thought I could put the text that I want as the header in a table, then use that in the header in the report. Here is the code:
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports CrystalDecisions.ReportSource
Imports System.Data.SqlServerCe
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim con As New SqlCeConnection
Dim t As New TestBirdDBDataSetTableAdapters.tblReportHeaderTableAdapter
Dim rpt As New CrystalReport1
Dim ds As New TestBirdDBDataSet
con.ConnectionString = "Data Source=|DataDirectory|\TestBirdDB.sdf"
con.Open()
t.Connection = con
t.Fill(ds.tblReportHeader)
con.Close()
rpt.SetDataSource(ds)
CrystalReportViewer1.ReportSource = rpt
End Sub
End Class
I get the following error when rpt.SetDataSource(ds) executes:
I have added all of the Crystal Reports references to the project.
I was using CR 13.08, upgraded to CR 13.0.10. No difference.
Could someone help me figure out 1) Why am I getting prompted for the parameter when it is being set in code, and 2) Why am I getting the error message in my simple test program?
Thank you