.Net Crystal Report Parameter Problems

Oct 3 2006 7:19 AM

Hi everyone,

 

Before I start, I would like to give thanks in advance for your help so far, it been greate…

 

Now then, I have a C# windows app. which includes a Crystal report control with the following code behide…

 

ReportDocument rpt = new ReportDocument();

 

string ReportPath = System.Configuration.ConfigurationSettings.AppSettings["Crystal:ReportDirectory"].ToString();

ReportPath = Path.Combine(ReportPath, cboReportList.SelectedItem.ToString() + ".rpt");

 

rpt.Load(ReportPath);

 

rpt.SetDatabaseLogon(System.Configuration.ConfigurationSettings.AppSettings["Crystal:ConnUserID"].ToString(), System.Configuration.ConfigurationSettings.AppSettings["Crystal:ConnPassword"].ToString(), System.Configuration.ConfigurationSettings.AppSettings["Crystal:ConnSource"].ToString(), System.Configuration.ConfigurationSettings.AppSettings["Crystal:ConnDatabase"].ToString());

 

My report has been setup using Crystal Reports 9 and the report uses a SQL strored procedure which takes one parameter of type string.

 

Now the problem than I’m experiencing is that when the reports opens, it prompts for a “Discrete Value” (…because it’s not being passed programmatically) and when you enter the value a BLANK REPORT displays.

 

It’s as if .Net h as a problem passing the parameter thru to the Crystal report.

 

I have tried the following,

 

Generating the report within Crystal 9 and passing the parameter – works fine

Removing the parameter, and then opening it from .Net – works fine,

Passing the parameter programmatically – Not so fine!!!

Entering the parameter when the .Net report prompts – Not so fine!!!

 

Any ideas???

 

Thanks again

Answers (1)