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:
Dim strConnection As String = "Data Source=gra002000;user id=user;password=pass;initial catalog=SSECURITE;Provider=SQLOLEDB;"
Dim Connection As New OleDbConnection(strConnection)
Dim strSQL As String = _
"SELECT * FROM AssembInfo WHERE AssembInfo.NoDossier='" & Me.txtDocket.Text & "' and AssembInfo.NoDosSec='" & Me.lstSecDos.Text & "'" _
& " ORDER BY AssembInfo.NoDossier, AssembInfo.NoDosSec"
Dim DA As New OleDbDataAdapter(strSQL, Connection)
Dim DS As New DataSet
DA.Fill(DS)
Dim strReportPath As String = Application.StartupPath & "\Assemblage.rpt"
Dim cr As New Assemblage
Dim subReport As New ReportDocument
Dim subReport2 As New ReportDocument
subReport = cr.OpenSubreport("Echantillons")
subReport.SetDataSource(DS)
subReport2 = cr.OpenSubreport("AssembContSeq")
subReport2.SetDataSource(DS)
cr.SetDataSource(DS)
cr.Load(strReportPath)
cr.PrintOptions.PrinterName = "\\grasrvr01\xeroxn40"
cr.PrintToPrinter(1, False, 0, 0)
Can anyone help me?
Thanks
Edit: Added [vbcode][/vbcode] tags for more clarity. - Hack