好吧,我有一个 Cyrstal 报告,其中有 4 个子报告,它通过 ItemID 列和 Culture 链接,所以它有一个参数值“?Pm-ItemID”和“?Pm-Culture”现在我正在使用 DataSet将数据加载到 Crystal Report 的数据源中,当我运行报告时,它给了我一个错误,即未提供询问参数字段,所以我想我的问题是我要传递给那些 ParameterFields 什么?
这是一个想法。
ReportDocument myreport = new ReportDocument();
myreport.Load("C:\MyReport.rpt");
DataSet ds = GenerateReportData();
myreport.SetDataSource(ds);
//Loop through each to Load the DataSet
for (int i = 0; i < myreport.Subreports.Count; i++)
{
ReportDocument subreport = myreport.SubReports[i];
DataSet subds = GenerateReportData(subreport.name)
subreport.SetDataSource(subds);
}
//I can see that there's a parameterfields in myreport.ParameterFields
//As I look through inside it there are 8 ParameterFields repeating Pm-ItemID and Pm-Culture
foreach (ParameterField pf in myreport.ParameterFields)
{
myreport.SetParameterValue(pf.Name, Value???);
}