我试图将参数从 Winform 传递到 Crystal Report,但收到此错误
缺少参数值
我的代码:
PrintCashReport cashreport = new PrintCashReport();
rptvwrcash.ReportSource = cashreport;
ParameterFields paramfields = new ParameterFields();
ParameterField type = new ParameterField();
type.Name = "type";
ParameterDiscreteValue dvtype = new ParameterDiscreteValue();
dvtype.Value = DailySalesReportBL.typeofrpt;
type.CurrentValues.Add(dvtype);
paramfields.Add(type);
rptvwrcash.ParameterFieldInfo = paramfields;
//PrintCashReport cashreport = new PrintCashReport();
cashreport.SetDataSource(ds);
cashreport.SetParameterValue("type", DailySalesReportBL.typeofrpt);
//rptvwrcash.ReportSource = cashreport;
System.Drawing.Printing.PrintDocument printDocument = new System.Drawing.Printing.PrintDocument();
cashreport.PrintOptions.PrinterName = printDocument.PrinterSettings.PrinterName;
cashreport.PrintOptions.PrinterName = "EPSON TM-T88V Receipt";
cashreport.PrintToPrinter(1, false, 0, 0);
Run Code Online (Sandbox Code Playgroud)
我检查了水晶报表中的参数名称,也没有问题。我已经检查了值,它也得到了正确的值。
所以请帮我找出我哪里错了。
谢谢