469,140 Members | 1,202 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,140 developers. It's quick & easy.

Crystal Reports for .NET and Oracle problem - Logon failed

Hi wise people,
Has anyone encountered the Crystal Reports problem I describe below?
If so, how did you solve it? It seems that every article posted on
google regarding CR and logon problems is still unanswered. I think
I'm cursed.

I originally created a crystal report which connects to a sql server
server db on the same dev machine and it worked just fine. I tried to
move it to another computer, but now I have to connect to an Oracle
database which resides on another server. So, I created a DSN called
myDSN, and changed my report to use the new DSN. I made sure that I
set the database name to "" (empty string) as specified by the Crystal
Support website: see
Unfortunately I keep getting a logon failure.
Any ideas about this problem?
I appreciate your help.

Here is my code:
'=========================BEGIN WEB FORM CODE ===============
Imports System.Data
Imports Microsoft.ApplicationBlocks.Data
Imports Microsoft.ApplicationBlocks.ExceptionManagement
Imports System.Data.OracleClient
Imports System.Text

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class rptSSCrystal
Inherits mywebapp.BaseReport
Protected WithEvents CrystalReportViewer1 As

Private oRpt As rptTestCR = New rptTestCR()
Private mStartDate As String = "14-01-2004 07:00:00" 'Oracle
Private mEndDate As String = "15-01-2004 07:00:00" 'Oracle

#Region "SQL Statements"
Dim mstrSQL As String = "SELECT datetime, department, reason,
oper_comment " _
& "FROM Table1 "

#End Region

#Region "Public properties"
Private Property StartDate()
Return mStartDate
End Get
Set(ByVal Value)
mStartDate = Value
End Set
End Property
Private Property EndDate()
Return mEndDate
End Get
Set(ByVal Value)
mEndDate = Value
End Set
End Property
#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

Dim ds As DataSet = New DataSet

'Add the where clause to the sql statement
mstrSQL += " WHERE datetime >= to_date('" & Me.StartDate &
"','DD-MM-YYYY HH24:MI:SS')" & " AND datetime <= to_date('" &
Me.EndDate & "','DD-MM-YYYY HH24:MI:SS')" & " ORDER BY datetime DESC"

'Get the dataset
ds = OracleHelper.ExecuteDataset(Me.ConnectionString,
CommandType.Text, mstrSQL)

'Use Report Engine object model to pass populated
' to report

'Set permissions
Dim crtableLogoninfos As New TableLogOnInfos
Dim crtableLogoninfo As New TableLogOnInfo
Dim crConnectionInfo As New ConnectionInfo
Dim CrTables As Tables
Dim CrTable As Table
Dim TableCounter

With crConnectionInfo
.ServerName = "myDSN"

'If you are connecting to Oracle there is no
'DatabaseName. Use an empty string.
'For example, .DatabaseName = ""

.DatabaseName = ""
.UserID = "myID"
.Password = "myPwd"
End With

CrTables = oRpt.Database.Tables

'Loop through each table in the report and apply the
'LogonInfo information

For Each CrTable In CrTables
crtableLogoninfo = CrTable.LogOnInfo
crtableLogoninfo.ConnectionInfo = crConnectionInfo

'CrystalReportViewer1.DisplayToolbar = False
CrystalReportViewer1.DisplayGroupTree = False
'Set the report source to the report component.
CrystalReportViewer1.ReportSource = oRpt
Catch exp As Exception
'Publish the error to the log file
'Add an error to the page Errors collection
Me.ErrorsList.Add("An error occured while connecting to
the database. Please contact the system administrator.")
End Try
End Sub

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub

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
'Do not modify it using the code editor.
End Sub

#End Region

End Class
'=========================END WEB FORM CODE ===============
Jul 21 '05 #1
0 2312

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Bonj | last post: by
2 posts views Thread by Karun Karunakaran | last post: by
2 posts views Thread by GFro | last post: by
3 posts views Thread by Milan Todorovic | last post: by
9 posts views Thread by mollyf | last post: by
3 posts views Thread by Shawn H. Mesiatowsky | last post: by
19 posts views Thread by Michael O'Donnell | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.