I want to generate a report with C# and Crystal Report.
in Crystal report, the data come from a stored procedure with parameter, there is a number parameter named @type, the valued was assigned form C# code:
discretevalue1 = new ParameterDiscreteValue();
discretevalue1.Value = "1";
ParameterValues values1 = new ParameterValues();
values1.Add(discretevalue1);
this.objRpt.DataDefinition.ParameterFields["@Type"].ApplyCurrentValues(values);
in Stored Procedure, the parameter was declared as:
Create PROCEDURE SP(@Type smallint) as ...
IF (@Type=1)
Begin
//doit
end
...
if I commented the line in SP: IF (@Type=1), the statement in doit could be executed successfully, I could see the correct data on the report. but if I did not commented the this line, the statement in doit would be executed, no data would be appeared on the report.
run the SP in SQL server: EXEC SP 1 will get the correct result.
I do not know what caused this issue. Could someone tell me how can I pass the number parameter to Stored Procedure in Crystal report?
Thanks for any help