1
我試圖通過從WinForm的水晶報表參數,但我得到這個錯誤缺少的參數值在水晶報表
缺少參數值
我的代碼:
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);
我在Crystal Report中檢查了參數的名字,這也很好。我檢查了價值,它也獲得了正確的價值。
所以請幫助我找出我錯在哪裏。
感謝
所以要我刪除'ParameterFields paramfields =新ParameterFields();''直到= rptvwrcash.ParameterFieldInfo paramfields;'? – mark
只是先評論你的舊代碼,然後嘗試按照新的代碼 –
仍然是相同的錯誤 – mark