I am using CR for VS 2010 (13.0.2000.0) and using the ASP.NET ReportViewer. I have a report where the datasource is set at runtime. I want to pass two parameters so I can display the date range of the query used to generate the data at the top of the report.
The report works correctly without the parameters but when I add the parameters to the report and set these parameters using ReportDocument.SetParameterValue, I still get prompted to enter these parameters. I don't want the user to be prompted again since they already entered these values for the database query.
How do pass parameters to the report so the user is not prompted to enter them?
Have a look at these parameter samples:
Thanks for the response. I tried the link you provided but I was unable to open the zip file. I am using the ASP.NET ReportViewer and here is my code. I don't understand why I continue to be prompted for the parameters.
ReportDocument rdoc = new ReportDocument();
rdoc.Load(HttpContext.Current.Server.MapPath("~/system/reports/rpt-files/" + reportName + ".rpt"));
CrystalReportViewer1.ReportSource = rdoc;
CrystalReportViewer1.ParameterFieldInfo = rdoc.ParameterFields;
If I set the parameters before setting the data source, the parameters are cleared. I'm not sure if I'm supposed to be setting the ParameterFieldInfo on the ReportViewer or not; it doesn't seem to make a difference either way. I have confirmed that HasCurrentValue is true for both parameters before .RefreshReport()
Download the below zip file which contains the sample applications.
Take a look at sample "\ReportDocObjectModel\Parameters"
I wonder if KB [1214110 - How to pass a Date/Time parameter to a report at runtime using VB .NET|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_bi/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233313334333133313330%7D.do] is the thing we're looking for?
Follow us on Twitter http://twitter.com/SAPCRNetSup
Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]
The code in the linked example does not work either. Additionally, the example code is incomplete and, frankly, seems very inefficient. When do you load the report? Why is it necessary to set a variable for the current values from the parameter field definition object then pass it to ApplyCurrentValues after setting the value?
What exactly is the example code supposed to solve regarding datetime parameters? Is the issue that you need to set the time portion to 12:01:00 AM? If so, why is this even necessary?
Why doesn't the SetParameterValue method work for datetime parameters?
Take a look at the [Developer guide|http://help.sap.com/businessobject/product_guides/sapCRVS2010/en/crnet_dg_2010_en.zip] and [APi reference guide |http://help.sap.com/businessobject/product_guides/sapCRVS2010/en/crnet_api_2010_en.zip]for CRVS 2010 .NET SDk, which will answer all your questions.