Link to home
Start Free TrialLog in
Avatar of gopaltayde
gopaltaydeFlag for India

asked on

Parameter values not showing up when pushing data to a Crystal report

I am using VS 2010 & Crystal reports for VS 2010. I developed a simple report using a stored proc. The stored proc has two parameters @Year & @Month. I am passing the parameters to crystal as below
                    crRptDoc.SetParameterValue("@Year", 2011);
                    crRptDoc.SetParameterValue("@Month", 5);
This works fine in pull method. The report is displayed correctly.
But if I tried to push the data using crRptDoc.SetDataSource(ds.Tables[0]); then the parameters doesn't display on the report, even though they are set in the code -
                    crRptDoc.SetParameterValue("@Year", 2011);
                    crRptDoc.SetParameterValue("@Month", 5);
                   crRptDoc.SetDataSource(ds.Tables[0]);
Please let me know what I am doing wrong.
Avatar of Mrunal
Mrunal
Flag of India image

ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gopaltayde

ASKER

Hi mlmcc, I agree with you that when we use the push method, the stored procedure isn't run.
But I wanted to display the Month & Year at the top of the report, which are passed by the user.
As you said, normal crystal parameters are working.
So I guess, I need to create 2 parameters for year and month respectively and pass the values to them.
Any other solutions?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Mroonal,

The 1st link provided by you doesn't have the accepted solution.
The 3rd link has a solution but not the complete one. It will pass the parameter value to crystal's parameter and not to the stored proc's parameter.
In short from my question I will have to modify the code as shown below -
                    crRptDoc.SetParameterValue("crYear", 2011);
                    crRptDoc.SetParameterValue("crMonth", 5);
Where crYear & crMonth are the crystal;s parameter and not the stored proc's.