水晶报表
// ReportDocument report = new ReportDocument();
// report.Load(rptPath);
// report.SetDataSource(dt);
// report.Refresh();
//
// CrystalReportViewer1.ReportSource = report;
//
FundRequirePlanReport = new ReportDocument();
FundRequirePlanReport.Load(rptPath);
FundRequirePlanReport.SetDataSource(dt);
FundRequirePlanReport.Subreports["title"].SetDataSource(title);
ParameterFields fields = new ParameterFields();
this.AddParameters("ContName",ContName,fields);
CrystalReportViewer1.ParameterFieldInfo = fields;
CrystalReportViewer1.ReportSource = FundRequirePlanReport;
public CrystalDecisions.Shared.ParameterFields AddParameters(string paramName,string paramValue,ParameterFields paramFields)
{
ParameterField paramField = new ParameterField();
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
ParameterValues paramValues = new ParameterValues();
paramField.Name = paramName;
paramDiscreteValue.Value = paramValue;
paramValues.Add(paramDiscreteValue);
paramField.CurrentValues = paramValues;
paramFields.Add(paramField);
return paramFields ;
}
public CrystalDecisions.Shared.ParameterFields AddParameters(string paramName,int paramValue,ParameterFields paramFields)
{
ParameterField paramField = new ParameterField();
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
ParameterValues paramValues = new ParameterValues();
paramField.Name = paramName;
paramDiscreteValue.Value = paramValue;
paramValues.Add(paramDiscreteValue);
paramField.CurrentValues = paramValues;
paramFields.Add(paramField);
return paramFields ;
}