Dim ConnectionInfo As ConnectionInfo = New ConnectionInfo() Dim CashReceipt As New ReportDocument() CashReceipt.Load(Application.StartupPath & "\Reports\Sale Reports\CashReceipt.rpt") Dim MyTables As Tables = CashReceipt.Database.Tables For Each MyTable As CrystalDecisions.CrystalReports.Engine.Table In MyTables Dim MyTableLogonInfo As TableLogOnInfo = MyTable.LogOnInfo ConnectionInfo.ServerName = ".\SQLEXPRESS" ConnectionInfo.DatabaseName = ""Admin ConnectionInfo.UserID = "sa" ConnectionInfo.Password = "admin" ConnectionInfo.IntegratedSecurity = False MyTableLogonInfo.ConnectionInfo = ConnectionInfo MyTable.ApplyLogOnInfo(MyTableLogonInfo) Next RPTfrmCashReport.CrystalReportViewer1.ReportSource = CashReceipt Dim mySelectionFormula As String = "{Invoice_Master.Invoice_no} = '" & FrmSalebill.LblInvoiceno.Text & "'" CashReceipt.RecordSelectionFormula = mySelectionFormula CashReceipt.PrintToPrinter(1, False, 0, 0)
CashReceipt.PrintOptions.PrinterName = "MyDesiredPrinterName"
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)