on 08-26-2014 9:42 PM
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
Hi Ralph
Searching (search box in top right corner) bring up the following:
Please see if the KBA helps.
- Ludek
Senior Support Engineer AGS Product Support, Global Support Center Canada
Follow us on Twitter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry Rich. I scanned the original query and zeroed in on the error, skipping over the parameter part. (as just a minor BTW., please create one post per issue). Anyhow, Looking at the code, there is obviously a few line missing;
I don't see the report being loaded
I don't see; rpt.SetParameterValue(0, strHeader)
Invariably, when you pass a value to the report, and the report prompts anyhow, either the type of the value is incorrect, or the parameter is assigned our of scope, so the engine has no idea it was assigned. Stepping through the code may help determine what is actually happening.
- Ludek
User | Count |
---|---|
84 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.