Public Sub printing() Dim rpt As New orderrpt() 'The report you created. Dim MyCommand As New SqlCommand() Dim myDA As New SqlDataAdapter() Dim myDS As New DataSet1() 'The DataSet you created. Dim cn As New SqlConnection(ConnectString()) Try MyCommand.Connection = cn MyCommand.CommandText = "SELECT * FROM foodordertbl where foilionum=" + folioid MyCommand.CommandType = CommandType.Text myDA.SelectCommand = MyCommand myDA.Fill(myDS, "foodordertbl") myDS.EnforceConstraints = False rpt.SetDataSource(myDS) CrystalReportViewer1.ReportSource = rpt rpt.PrintOptions.PrinterName = "EPSON TM-T88IV Receipt" rpt.PrintToPrinter(1, False, 0, 0) Catch Excep As Exception MessageBox.Show(Excep.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)