cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass values to be displayed on the report?

Former Member
0 Kudos

I have an ASP.Net page that has values from the user that needs to be displayed in the page header of the report. Those values need to be passed to the report.

I am using Crystal Reports 2011.  The code behind for ASP.Net page is written in VB.Net.

I had thought of using Parameter fields in the report and using the SetParameterValue method of ReportDocument but I am not familiar with using Parameter fields.

How to set up the report to do this?

Sincerely,

Keith Jackson

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos
Former Member
0 Kudos

Thanks Dhananjay but that does not give me the info.

I did create the parameter fields and inserted them into the report.

I did add code to call the SetParameterValues method in my ASP.Net page.

I am not sure I have the parameter fields set up correctly because when my ASP.Net tries to display the report in the CrystalReportViewer, it has the message " Error missing parameters."

Here is what my Parameter field editor looks like in Crystal Reports 2011.

Please help.  Thanks!

Sincerely,

Keith Jackson

Former Member
0 Kudos

Keith,

You passed  Mycriteria Parameter in code to crystal report  and check the  code part.

For ex:  Missing parameter values after passing parameters to crystal report

Programmatically pass parameters into a Crystal report from VB.NET

Thanks,

DJ

former_member183750
Active Contributor
0 Kudos

Hi Keith

DJ has some very good suggestions, but the first thing we want to do is to make sure the report works in the designer as you want it to. Reading this thread, I'm a bit unsure if the report does actually work in the designer - can you please comment on that?

If it does, I like to go from simple as far as coding is concerned. In this case, that would mean not worrying about the parameters or logon and let the report engine do the heavy lifting for us:

Create a new project. Throw a CR viewer on a form and add one line of code in page load:

CrystalReportViewer1.ReportSource = <path to the report>

The engine will prompt for the db logon as well as the parameters. Fill those out. The report should then display on the screen.

From here we can get fancy and add DB logon code as well as the parameter code.

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow us on Twitter

Former Member
0 Kudos

Hi Ludek,

    The report does work in the designer and does work in the CrystalReportViewer in the ASP.Net page before adding the parameter fields to the report.

     I finally got to the parameter fields to work.  I went to the link called "Programmatically pass parameters into a Crystal Report from VB.Net" that DJ gave above in his reply.  In that article, it mentioned that if your DataSource is from a .xsd (Dataset) then the DataSource needs to be set before setting the parameters.  In this case, my DataSource is a dataset so I changed the code to set the DataSource first and then set the parameters.  That got it to work.

Sincerely,

Keith Jackson

former_member183750
Active Contributor
0 Kudos

Oh wow. Excellent. Nice going for DJ . I suppose I just wanted to be a bit more cautious, but kudos to both of you.

Have a great evening,

- Ludek

Answers (0)