none
Printing using a SQL Command RRS feed

  • Question

  • I am using the following code and it does not work neither does it goes to the "Catch ex As Exception" part.

    Please Help

    Try
             Dim ds As New DataSet()
             Dim MySql As String
             MySql = "Select JOBNO,CLNAME,ADD1,ADD2,TEL,CELL,TECH,REM1 FROM JOB WHERE JOBNO='" & strCode & "'"
             MyCn.Open()
             Dim Cmd2 As New OleDbDataAdapter(MySql, MyCn)
             Cmd2.Fill(ds, "JOB")
            
             Dim cryRpt As New ReportDocument
             cryRpt.Load("C:\NAC\Job2.rpt")
             cryRpt.SetDataSource(ds.Tables(1))
             CrystalReportViewer1.ReportSource = cryRpt
             CrystalReportViewer1.Refresh()
             CrystalReportViewer1.PrintReport()
             Cmd2.Dispose()
    Catch ex As Exception
             MessageBox.Show("Cannot open Job Card Files...")
    End Try
            


    Navin

    • Moved by Carl Cai Monday, November 17, 2014 2:08 AM issues related to third-party are not supported
    Friday, November 14, 2014 11:34 AM

All replies

  • By searching it looks like this is the way:
    Dim report As New CrystalDecisions.CrystalReports.Engine.ReportDocument
    Dim repName As String
    repName = CrystalReportSource1.ReportDocument.FileName
    report.Load(repName)
    report.PrintToPrinter(1, False, 0, 0)

    Friday, November 14, 2014 12:36 PM
  • Hi Navin Balkissoon,

    According to your description, Your question is related to Crystal reports, It is not supported here.

    You could consider posting it in its official forum for supports. Thanks.

    http://scn.sap.com/community/crystal-reports/#

    Best regards,
    Youjun Tang


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, November 17, 2014 2:07 AM