Crystal reports drives me absolutely bonkers with issues like this. My problem is that Ive created a crystal report that is located on the server in which the report source is a stored procedure from MSSQL. Now I have two parameter fields Start and End along with some formulas. The issue is that if I set the report up like thus:
I get a problem with the formula field saying that the parameters Start and End are not known. So I changed the code to pass in the parameters to the report using its datadefinitions using examples I found on the web but now I am receiving this error:
Error in formula <Total>
IIF ({spPayrollTransmittal;1.SalaryType} = H, {spPayrollTransmittal;1.Regular} + {spPayrollTransmittal;1.Overtime}, 40)
This field name is not known.
This tells me that Im successfully passing the parameters but now that Im not physically setting the datasource, its as if it doesnt recognize the db fields. Funny thing is the report runs fine in the designer. Now Ive tried playing with the code, by incorporating both methods and even hard coding my parameters just to see if the report would run (which it did succesfully). My problem is how do I pass parameters to my report which I want to run from the server without the above error??
Thank you very much for any help you can give me, Ive been hacking at this for two days now without any luck.
Code:
crReportDocument.Load(rptPayrollTransmittal)
crReportDocument.SetParameterValue("@Start", CDate(txtStart.Text))
crReportDocument.SetParameterValue("@End", CDate(txtEnd.Text))
crReportDocument.SetDataSource(dsPayroll.Tables(0))
I get a problem with the formula field saying that the parameters Start and End are not known. So I changed the code to pass in the parameters to the report using its datadefinitions using examples I found on the web but now I am receiving this error:
Error in formula <Total>
IIF ({spPayrollTransmittal;1.SalaryType} = H, {spPayrollTransmittal;1.Regular} + {spPayrollTransmittal;1.Overtime}, 40)
This field name is not known.
This tells me that Im successfully passing the parameters but now that Im not physically setting the datasource, its as if it doesnt recognize the db fields. Funny thing is the report runs fine in the designer. Now Ive tried playing with the code, by incorporating both methods and even hard coding my parameters just to see if the report would run (which it did succesfully). My problem is how do I pass parameters to my report which I want to run from the server without the above error??
Thank you very much for any help you can give me, Ive been hacking at this for two days now without any luck.