CR.net Logon failed error, please help!!!

stsong

New member
Joined
Dec 20, 2004
Messages
2
What does it take to get SQL Crystal Report to work? :confused:
CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed. :(
I can view Access Database reports without a problem but when it comes to SQL server, this is the furthest Ive been. I am so loss, can somebody show me a working example? Please help me! I really appreciate your help. :)
 
stsong said:
What does it take to get SQL Crystal Report to work? :confused:
CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed. :(
I can view Access Database reports without a problem but when it comes to SQL server, this is the furthest Ive been. I am so loss, can somebody show me a working example? Please help me! I really appreciate your help. :)

There is a number of steps that you can take.
1. Dont use the crystal viewer if this is a web project. Take your report and display it as a pdf. Here is the code...
Code:
Dim oRpt As New crptAbsentStudents

Try
            Dim crLogonInfo As CrystalDecisions.Shared.TableLogOnInfo
            crLogonInfo = oRpt.Database.Tables(0).LogOnInfo
            crLogonInfo.ConnectionInfo.ServerName = "****_****"
            crLogonInfo.ConnectionInfo.UserID = "****"
            crLogonInfo.ConnectionInfo.Password = "****"
            oRpt.Database.Tables(0).ApplyLogOnInfo(crLogonInfo)

            Dim myExportOptions As CrystalDecisions.Shared.ExportOptions
            Dim myDiskFilesDestinationOptions As CrystalDecisions.Shared.DiskFileDestinationOptions
            Dim myExportFile As String

            myExportFile = "C:\temp\PDF " & Session.SessionID.ToString & ".pdf"
            myDiskFilesDestinationOptions = New CrystalDecisions.Shared.DiskFileDestinationOptions
            myDiskFilesDestinationOptions.DiskFileName = myExportFile
            myExportOptions = oRpt.ExportOptions

            With myExportOptions
                .DestinationOptions = myDiskFilesDestinationOptions
                .ExportDestinationType = .ExportDestinationType.DiskFile
                .ExportFormatType = .ExportFormatType.PortableDocFormat
            End With

            oRpt.Export()

            Response.ClearContent()
            Response.ClearHeaders()
            Response.ContentType = "application/pdf"
            Response.WriteFile(myExportFile)
            Response.Flush()
            Response.Close()

            System.IO.File.Delete(myExportFile)
        Catch ex As Exception
            Throw ex
        End Try

2. Change the damn sa account and give it a password. Even better get rid of the damn account if you can.

Mike55
 
mike55 said:
There is a number of steps that you can take.
1. Dont use the crystal viewer if this is a web project. Take your report and display it as a pdf. Here is the code...
Code:
Dim oRpt As New crptAbsentStudents

Try
            Dim crLogonInfo As CrystalDecisions.Shared.TableLogOnInfo
            crLogonInfo = oRpt.Database.Tables(0).LogOnInfo
            crLogonInfo.ConnectionInfo.ServerName = "****_****"
            crLogonInfo.ConnectionInfo.UserID = "****"
            crLogonInfo.ConnectionInfo.Password = "****"
            oRpt.Database.Tables(0).ApplyLogOnInfo(crLogonInfo)

            Dim myExportOptions As CrystalDecisions.Shared.ExportOptions
            Dim myDiskFilesDestinationOptions As CrystalDecisions.Shared.DiskFileDestinationOptions
            Dim myExportFile As String

            myExportFile = "C:\temp\PDF " & Session.SessionID.ToString & ".pdf"
            myDiskFilesDestinationOptions = New CrystalDecisions.Shared.DiskFileDestinationOptions
            myDiskFilesDestinationOptions.DiskFileName = myExportFile
            myExportOptions = oRpt.ExportOptions

            With myExportOptions
                .DestinationOptions = myDiskFilesDestinationOptions
                .ExportDestinationType = .ExportDestinationType.DiskFile
                .ExportFormatType = .ExportFormatType.PortableDocFormat
            End With

            oRpt.Export()

            Response.ClearContent()
            Response.ClearHeaders()
            Response.ContentType = "application/pdf"
            Response.WriteFile(myExportFile)
            Response.Flush()
            Response.Close()

            System.IO.File.Delete(myExportFile)
        Catch ex As Exception
            Throw ex
        End Try

2. Change the damn sa account and give it a password. Even better get rid of the damn account if you can.

Mike55

Hey Mike,
I really appreciate your post. I just now getting back to this project. I am still getting Logon Failed. My frustration is beyond belief. Can somebody show me a full example to display a Crystal Report with SQL server back end and also converting the report to PDF? Please, please help!
 
Back
Top