By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,199 Members | 1,474 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,199 IT Pros & Developers. It's quick & easy.

Generate a Crystal Report with a Parameter

P: n/a
I have a crystal report which I need my application to generate. I can
do it like this:

ReportDocument thisReport = new ReportDocument();
thisReport.Load(inFilename);
thisReport.Refresh();
thisReport.ExportToDisk(ExportFormatType.PortableD ocFormat,outputFilename);
thisReport.Close();

This works perfectly. Now I have a crystal report that takes a
parameter called "FirewallId". I have tried to make the code like
this:

ReportDocument thisReport = new ReportDocument();
thisReport.Load(inFilename);
thisReport.SetParameterValue("FirewallId",25);
thisReport.Refresh();
thisReport.ExportToDisk(ExportFormatType.PortableD ocFormat,outputFilename);
thisReport.Close();

but I get missing parameter value. When I inspect "thisReports" fields
I am told there are two *more* parameters both called intid. Setting
them gives me errors - You cannot set parameters on linked fields and
not setting them gives me missing parameters error.

Can anyone help me please?
Jun 27 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Try something like this, to see all the Parameter fields, and then just set
them

foreach (ParameterField field in thisReport.ParameterFields)
{
MessageBox.Show(field.Name);
thisReport.SetParameterValue(field.Name,"whateverv alue");
}

"Philluminati" <Ph*****************@gmail.comwrote in message
news:8c**********************************@m45g2000 hsb.googlegroups.com...
>I have a crystal report which I need my application to generate. I can
do it like this:

ReportDocument thisReport = new ReportDocument();
thisReport.Load(inFilename);
thisReport.Refresh();
thisReport.ExportToDisk(ExportFormatType.PortableD ocFormat,outputFilename);
thisReport.Close();

This works perfectly. Now I have a crystal report that takes a
parameter called "FirewallId". I have tried to make the code like
this:

ReportDocument thisReport = new ReportDocument();
thisReport.Load(inFilename);
thisReport.SetParameterValue("FirewallId",25);
thisReport.Refresh();
thisReport.ExportToDisk(ExportFormatType.PortableD ocFormat,outputFilename);
thisReport.Close();

but I get missing parameter value. When I inspect "thisReports" fields
I am told there are two *more* parameters both called intid. Setting
them gives me errors - You cannot set parameters on linked fields and
not setting them gives me missing parameters error.

Can anyone help me please?

Jun 27 '08 #2

P: n/a
On May 23, 7:54*am, Philluminati <Phillip.Ross.Tay...@gmail.com>
wrote:
I have a crystal report which I need my application to generate. I can
do it like this:

ReportDocument thisReport = new ReportDocument();
thisReport.Load(inFilename);
thisReport.Refresh();
thisReport.ExportToDisk(ExportFormatType.PortableD ocFormat,outputFilename);
thisReport.Close();

This works perfectly. Now I have a crystal report that takes a
parameter called "FirewallId". I have tried to make the code like
this:

ReportDocument thisReport = new ReportDocument();
thisReport.Load(inFilename);
thisReport.SetParameterValue("FirewallId",25);
thisReport.Refresh();
thisReport.ExportToDisk(ExportFormatType.PortableD ocFormat,outputFilename);
thisReport.Close();

but I get missing parameter value. When I inspect "thisReports" fields
I am told there are two *more* parameters both called intid. Setting
them gives me errors - You cannot set parameters on linked fields and
not setting them gives me missing parameters error.

Can anyone help me please?
Hi,

you use ReportDocument.SetParameterValue()
Jun 27 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.