将报告直接打印到打印机

2020-08-26 01:45发布

点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)我直接将报告发送给打印机,但这显...

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


我直接将报告发送给打印机,但这显示在最后一行

(CrystalDecisions.CrystalReports.Engine.LogOnException:'数据库登录失败。)

'*********代码从此处开始************************

将ConnectionInfoDiscount设置为ConnectionInfo = New ConnectionInfo()

将CashReceiptAfterInvoiceDiscount设置为新的ReportDocument()昏暗CashReceiptAfterInvoiceDiscount.Load(Application.StartupPath和" \ CashReceip.rpt")

Dim Computech As Tables = CashReceipt.Database.Tables

对于每个Computech,如Computech中的CrystalDecisions.CrystalReports.Engine.Table

将ComputechLogonInfo设置为TableLogOnInfo = Dim

ConnectionInfoDiscount.ServerName ="。\ SQLEXPRESS"

ConnectionInfoDiscount.DatabaseName =" Computech"

ConnectionInfoDiscount.UserID ="管理员"

ConnectionInfoDiscount.Password ="管理员"

ConnectionInfoDiscount.IntegratedSecurity = True

ComputechLogonInfo.ConnectionInfo = ConnectionInfoDiscount Computech.ApplyLogOnInfo(ComputechLogonInfo)下一页

RPTfrmCashReportDiscount.CrystalReportViewerDiscount.ReportSource = CashReceiptAfterInvoiceDiscount RPTfrmCashReportDiscount.CrystalReportViewerDiscount.SelectionFormula =" {Invoice_Master.Invoice_date} = DateTime("&DiscountStartDate&")和{Invoice_}(In&Invoice _}。In。 '**********************不带预览的打印报告**********************

将ReportCashReceipt设置为新System.Drawing.Printing.PrintDocument CashReceiptAfterInvoiceDiscount.PrintOptions.PrinterName = ReportCashReceipt.PrinterSettings.PrinterName CashReceiptAfterInvoiceDiscount.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize1.PaperA4

2条回答
xfwsx85
2020-08-26 02:21 .采纳回答

您不能设置用户ID和密码,并且"集成安全性"也设置为True。 集成安全性意味着Crystal将使用当前OS用户的凭据登录数据库。

请参阅博客文章此处,以链接到示例代码,向您展示如何执行此操作。

-戴尔

一周热门 更多>