Quantcast
Channel: SCN : Discussion List - SAP Crystal Reports, version for Visual Studio
Viewing all articles
Browse latest Browse all 3636

Being prompted for a parameter

$
0
0

Hi, Ludek,

 

I hope it's okay, but I thought it would be better to start a new post about the parameter issue.

 

To recap, the issue is:

 

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.

 

The code I posted was the code that generated the .dll error, not the code working with parameters.

 

This is the code working with parameters:

 

    Private Sub frmPrintAppointments_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

 

        Dim rpt As New rptAppointments

        Dim strHeader as String

     

        ' I populate the dataset, ds

 

        strHeader = "All appointments"

        rpt.Load()

       rpt.SetParameterValue(0, strHeader)

       rpt.SetDataSource(ds)

       CrystalReportViewer1.Dock = Windows.Forms.DockStyle.Fill

       CrystalReportViewer1.ReportSource = rpt

       CrystalReportViewer1.Visible = True

 

    End Sub

 

You said:

 

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.

 

The parameter is of string type. How do you specify the scope of a parameter?

 

 

Thanks,

 

Ralph


Viewing all articles
Browse latest Browse all 3636

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>