Hi All.
I have a report developed in Crystal XI. It has stored procedure as data source, which takes two parameters (@StarDate and @EndDate). I use those data parameters in formulas and everything works great, when I run report in Crystal.
I added report to VS2005 project and when I try to run it, I get an error: "This field name is not known" and tells formula name. If I comment content of that formula, it moves to next with the same error.
I need some help with this as it holds me from deploying my project. Any ideas what might cause this error?
Thanks for your help.
Code I'm using to open report:
Code:
Critical_Stations oRpt = new Critical_Stations();
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = new SqlCommand("exec usp_RPT_CRIT_STATIONS '" + StartDate + "','" + EndDate + "'", this.GetConnection("HTCIS"));
DataTable dt = new DataTable("CS");
da.Fill(dt);
/* Start date */
ParameterField pfBeginDate = new ParameterField();
ParameterDiscreteValue pvBeginDate = new ParameterDiscreteValue();
pfBeginDate.ParameterFieldName = "@STARTDATE";
pvBeginDate.Value = StartDate;
pfBeginDate.CurrentValues.Add(pvBeginDate);
/* End Date */
ParameterField pfEndDate = new ParameterField();
ParameterDiscreteValue pvEndDate = new ParameterDiscreteValue();
pfEndDate.ParameterFieldName = "@ENDDATE";
pvEndDate.Value = EndDate;
pfEndDate.CurrentValues.Add(pvEndDate);
/* Add parameters to viewer */
ParameterFields pFields = new ParameterFields();
pFields.Add(pfBeginDate);
pFields.Add(pfEndDate);
crw.ParameterFieldInfo = pFields;
/* Set report source and open it */
oRpt.SetDataSource(dt.DefaultView);
crw.ReportSource = oRpt;
This is one of the formulas I use in Crystal, named "FormatStartDTTM" that causes an error:
Code:
Date({?@STARTDATE});