我正在使用水晶报告并尝试打印发票。我通过对象列表而不是数据库填充水晶报告。但我正面对水晶报告数据库连接窗口。我需要绕过它。
我的代码如下:
List<ReportHeader> RH = new List<ReportHeader>();
RH.Add(new ReportHeader("212EE212", "000004", "Asghar", "2234", "Ahmad", "Nice Transaction", "2/25/2016", "16:45"));
List<ReportDetail> RD = new List<ReportDetail>();
RD.Add(new ReportDetail("inpironD610", 3, 35000, 105000));
RD.Add(new ReportDetail("inpironD986", 3, 35000, 105000));
List<ReportFooter> RF = new List<ReportFooter>();
RF.Add(new ReportFooter(210000,4500,214500));
ReportDocument rptDoc = new ReportDocument();
InvoiceReport IR = new InvoiceReport();
IR.SetDataSource(RH);
IR.SetDataSource(RD);
IR.SetDataSource(RF);
IR.PrintToPrinter(1, true, 0, 0);
InvoiceReportViewer.ReportSource = IR;