Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

changing Datasource clears report parameters

Status
Not open for further replies.

olichap

Programmer
Mar 20, 2001
389
US
Hey all,

I've CR9/C# application that calls the ReportDocument.SetDataSource method, passing it a DataTable populated earlier.

The report, if run on its own, requires four variables. The report Stored Proc gets called earlier through code, hence my using SetDataSource to pass-in the data.

My problem is that I use a couple of the report parameters in the report's design (DateFrom, DateTo, etc.). When I change the DataSource it clears out the ParameterFields array. So I'm looking for an easy way to store and re-create the parameters. I've tried the following which does store the variables in a ParameterFields object:

CrystalDecisions.Shared.ParameterFields crParams = new CrystalDecisions.Shared.ParameterFields(rptTest.DataDefinition.ParameterFields);

However executing the following later doesn't work:

rptTest.DataDefinition.ParameterFields = crParams;
(error message="Cannot implicitly convert type 'CrystalDecisions.Shared.ParameterFields' to 'CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinitions'")

Is there a way I can copy in the ParameterFields collection/array?

Thanks,

O.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top