on 09-09-2014 6:05 PM
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
Hello Keith,
VB.NET Crystal Reports String parameter
visual studio 2010 - Steps to Pass parameters to crystal reports in C# - Stack Overflow
Check the above link and share more updates..
Thank,
DJ
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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
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
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.