Passing Date parameters to crystal reports in asp.net application
-
I am looking for some help in passing a start and end date parameter to a crystal report from within an asp.net application. I currently have an aspx page with two calender objects one for start date and one for end date. When the user selects both a start date and an end date I want to pass these values to my crystal report so that the data the user sees in the report is filtered by these dates. I currently have this code: ParameterField1.ParameterFieldName = "SelectedFilterDates"; ParameterRangeValue RangeValue = new CrystalDecisions.Shared.ParameterRangeValue(); RangeValue.StartValue = (DateTime)Session["StartDate"]; RangeValue.EndValue = (DateTime)Session["EndDate"]; ParameterField1.CurrentValues.Add(RangeValue); ParameterFields.Add(ParameterField1); CrystalReportViewer1.ParameterFieldInfo = ParameterFields; CrystalReportViewer1.ReportSource = CurrentReport; Will this code work? I am not exactly sure what I need to add to the report as far as parameter fields? Please help if you can! Another question, if I have a report with more than one date field can I switch which date field the parameters are used in? What if the user selects a date range that is not in the range within the values of the report? Thanks for helping out a newbie! Frank