[Resolved] Logon failed for Crystal Report
I created a report called CigUnitsRpt.rpt. I then put the crviewer control on my web page and used the following code.
VB Code:
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class CigUnitsProcess
Inherits System.Web.UI.Page
Protected WithEvents CrystalReportViewer1 As CrystalDecisions.Web.CrystalReportViewer
Dim crpt As CigUnitsRpt
Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
Dim myLogin As CrystalDecisions.Shared.TableLogOnInfo
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
crpt = New CigUnitsRpt()
For Each myTable In crpt.Database.Tables
myLogin = myTable.LogOnInfo
myLogin.ConnectionInfo.Password = "password"
myLogin.ConnectionInfo.UserID = "user"
myTable.ApplyLogOnInfo(myLogin)
Next
CrystalReportViewer1.ReportSource = Server.MapPath("CigUnitsRpt.rpt")
If Not IsPostBack Then
End If
End Sub
End Class
I'm thinking it might not know where CigUnitsRpt.rpt is or something like that.
Here is the error message I get.
Logon failed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[LogOnException: Logon failed.]
.K(String
, EngineExceptionErrorID )
.F(Int16 , Int32 )
.E(Int16 )
CrystalDecisions.CrystalReports.Engine.FormatEngine.GetPage(PageRequestContext reqContext)
CrystalDecisions.ReportSource.LocalReportSourceBase.GetPage(PageRequestContext pageReqContext)
CrystalDecisions.Web.ReportAgent.v(Boolean `)
CrystalDecisions.Web.CrystalReportViewer.OnPreRender(EventArgs e)
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Page.ProcessRequestMain()