我正在使用C#,.NET Framework 4.0构建桌面应用程序 我试图将参数从我的C#表单传递到我的水晶报表10.0,但它不起作用,它会抛出此错误:
指定的演员表无效。
以下是我传递参数的代码:
ReportDocument cryRpt = new ReportDocument();
cryRpt.Load(@"Report\food.rpt");
ParameterFieldDefinitions crParameterFieldDefinitions ;
ParameterFieldDefinition crParameterFieldDefinition ;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = Convert.ToInt32(textBoxX1.Text);
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["foodID"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
this.axCrystalActiveXReportViewer1.ReportSource = cryRpt;
this.axCrystalActiveXReportViewer1.Refresh();