|
-
Apr 18th, 2003, 09:46 AM
#1
Thread Starter
Lively Member
(Logon failed) ASP .NET and Crystal Report Viewer
Hi,
I have created an .aspx page that contains a crystal report viewer and this report gets data from a MS SQL Server 2000. But when I run this page I always get the following error, even thought I set a right username and password:
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.
This is my codes:
'====================
Imports System
Imports Microsoft.Win32
Public Class simplepage1
Inherits System.Web.UI.Page
Protected WithEvents CrystalReportViewer1 As CrystalDecisions.Web.CrystalReportViewer
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
CrystalReportViewer1.ReportSource = GetSampleReportsDir() + "General Business\World Sales Report.rpt"
Call SetLogOnInfo()
CrystalReportViewer1.DataBind()
'Response.End()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Private Function GetSampleReportsDir() As String
'Get the path VS was installed to
Dim regKey As RegistryKey
Dim dir As String
regKey = Registry.LocalMachine
regKey = regKey.OpenSubKey("Software\\Microsoft\\VisualStudio\\7.0\\Setup\\VS")
dir = regKey.GetValue("ProductDir").ToString()
dir += "Crystal Reports\Samples\Reports\"
GetSampleReportsDir = dir
End Function
Private Sub SetLogOnInfo()
' Set the connection information for the table in the report.
CrystalReportViewer1.LogOnInfo(0).ConnectionInfo.ServerName = "TRUNGPSL"
CrystalReportViewer1.LogOnInfo(0).ConnectionInfo.DatabaseName = "QLRR"
CrystalReportViewer1.LogOnInfo(0).ConnectionInfo.UserID = "sa"
CrystalReportViewer1.LogOnInfo(0).ConnectionInfo.Password = "sa12"
CrystalReportViewer1.LogOnInfo(0).TableName = "Customer"
End Sub
End Class
'===========
Could you please tell me how to resolve this problem?
Thanks in advance,
Trung Luu
-
Apr 23rd, 2003, 11:56 AM
#2
Lively Member
I also have recieved this error on ocasion. I was thinking that it was caused because a liscnence wasnt available for that user. But Ive seen other errors for when that happens so Im not sure why. Maybe crystal descions site has some sort of documentation on this error
"All those who wonder are not lost" -j.r.r tolkien
-
Apr 25th, 2003, 07:43 AM
#3
Thread Starter
Lively Member
-
Nov 24th, 2003, 12:09 PM
#4
Fanatic Member
Trungluu, I tried what they said to do at the link you provided. I am still getting a log on error.
Could you take a look at my code and tell me if you see anything wrong?
VB Code:
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class CigUnitsProcess
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Dim crpt As CigUnitsRpt
Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
Protected WithEvents CrystalReportViewer1 As CrystalDecisions.Web.CrystalReportViewer
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
With myLogin.ConnectionInfo
.ServerName = "Brutus"
.UserID = "User"
.Password = "Pass"
.DatabaseName = "Daily"
End With
myTable.ApplyLogOnInfo(myLogin)
Next
CrystalReportViewer1.ReportSource = crpt
CrystalReportViewer1.DataBind()
If Not IsPostBack Then
End If
End Sub
End Class
Thanks
-
Nov 24th, 2003, 02:34 PM
#5
Fanatic Member
Well, something weird happened. I deleted the report and re-created it and now there's no logon error.
Oh well, as long as it works.... lol
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|