Results 1 to 1 of 1

Thread: Problem printing a Crystal Report in VB .NET

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Posts
    172

    Problem printing a Crystal Report in VB .NET

    Hi, when I try to print my report I got an error

    "An unhandled exception of type 'CrystalDecisions.CrystalReports.Engine.LogOnException' occurred in crystaldecisions.crystalreports.engine.dll

    Additional information: Database logon failed."

    Here's my code.
    VB Code:
    1. Dim strConnection As String = "Data Source=gra002000;user id=user;password=pass;initial catalog=SSECURITE;Provider=SQLOLEDB;"
    2.             Dim Connection As New OleDbConnection(strConnection)
    3.             Dim strSQL As String = _
    4.             "SELECT * FROM AssembInfo WHERE AssembInfo.NoDossier='" & Me.txtDocket.Text & "' and AssembInfo.NoDosSec='" & Me.lstSecDos.Text & "'" _
    5.             & " ORDER BY AssembInfo.NoDossier, AssembInfo.NoDosSec"
    6.  
    7.             Dim DA As New OleDbDataAdapter(strSQL, Connection)
    8.             Dim DS As New DataSet
    9.             DA.Fill(DS)
    10.  
    11.             Dim strReportPath As String = Application.StartupPath & "\Assemblage.rpt"
    12.             Dim cr As New Assemblage
    13.             Dim subReport As New ReportDocument
    14.             Dim subReport2 As New ReportDocument
    15.             subReport = cr.OpenSubreport("Echantillons")
    16.             subReport.SetDataSource(DS)
    17.             subReport2 = cr.OpenSubreport("AssembContSeq")
    18.             subReport2.SetDataSource(DS)
    19.             cr.SetDataSource(DS)
    20.             cr.Load(strReportPath)
    21.             cr.PrintOptions.PrinterName = "\\grasrvr01\xeroxn40"
    22.             cr.PrintToPrinter(1, False, 0, 0)

    Can anyone help me?

    Thanks









    Edit: Added [vbcode][/vbcode] tags for more clarity. - Hack
    Last edited by Hack; Jan 17th, 2006 at 11:01 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width