Crystal reports 关于C的水晶报告#
我有一个Cyrstal报表,它有4个子报表,它通过一个ItemID列和一个区域性链接,因此它有一个参数值“?Pm ItemID”和“?Pm Culture”。现在我使用数据集将数据加载到Crystal报表的数据源,当我运行报表时,它给我一个错误,这是一个询问参数字段,不支持,所以我想我的问题是,我要把什么传递给这些参数字段 有个主意Crystal reports 关于C的水晶报告#,crystal-reports,subreport,Crystal Reports,Subreport,我有一个Cyrstal报表,它有4个子报表,它通过一个ItemID列和一个区域性链接,因此它有一个参数值“?Pm ItemID”和“?Pm Culture”。现在我使用数据集将数据加载到Crystal报表的数据源,当我运行报表时,它给我一个错误,这是一个询问参数字段,不支持,所以我想我的问题是,我要把什么传递给这些参数字段 有个主意 ReportDocument myreport = new ReportDocument(); myreport.Load("C:\MyReport.rpt");
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???);
}
reportdocumentmyreport=newreportdocument();
加载(“C:\myreport.rpt”);
数据集ds=GenerateReportData();
myreport.SetDataSource(ds);
//循环遍历每个数据集以加载数据集
对于(int i=0;i
我不知道Crystal,但在SSRS中它是这样工作的:
1) 创建子报表并创建一些参数
2) 创建主报表,将子报表放在那里,并在属性中指定要绑定到子报表参数的内容
结论:我认为这不应该在代码中设置,而应该在报表设计器中设置。我不知道Crystal,但在SSRS中它是这样工作的: 1) 创建子报表并创建一些参数 2) 创建主报表,将子报表放在那里,并在属性中指定要绑定到子报表参数的内容
结论:我认为这不应该在代码中设置,而应该在报表设计器中设置。好吧,我知道出了什么问题
ReportDocument subreport = myreport.SubReports[i];
DataSet subds = GenerateReportData(subreport.name)
subreport.SetDataSource(subds);
不应该这样做,应该这样做
DataSet subds = GenerateReportData(subreport.name)
myreport.SubReports[i].SetDataSource(subds);
我知道怎么了
ReportDocument subreport = myreport.SubReports[i];
DataSet subds = GenerateReportData(subreport.name)
subreport.SetDataSource(subds);
不应该这样做,应该这样做
DataSet subds = GenerateReportData(subreport.name)
myreport.SubReports[i].SetDataSource(subds);
它是在报表设计器中设置的,它链接到MainItemReport.ItemID链接到SubItemReport.ItemID等等,但是当报表运行时,它要求?Pm ItemID和?Pm Cultureas的值。您可以看到,我认为通过每个子报表设置数据集就足够了,请注意foor循环,但是随着它的运行,我得到一个错误,一些参数字段没有值。它是在报表设计器中设置的,它链接到MainItemReport.ItemID链接到SubItemReport.ItemID等等,但是当报表运行时,它要求?Pm ItemID和?Pm Cultureas的值。如您所见,我认为通过每个子报表设置数据集就足够了,注意foor循环,但随着它的发展,我得到了一个错误,一些参数字段没有值。我忘了这是一个com对象,可能不支持oop。我忘了这是一个com对象,可能不支持oop。