Crystal Reports + Logon Failed

  • Thread starter Thread starter Michael O'Donnell
  • Start date Start date
M

Michael O'Donnell

Hi All

Am having major problem with crystal reports...Have
designed my report no problem, its when I try to run and
display ther report that I am getting a "Login Failed"
message. At first I thought it might have to do with the
regristration key, but that ok, when I right click on
Servers in the server explorer and then expand the
Crystal Server, there is a red x beside the Crystal
Enterprise. When I click on log in, I am asked for a
username and a password. I don't know what to put into
these fields, can anyone suggest a solution.

Michael
 
Apply the following function to your report.
Note: If you report contains subreports, you must apply the function
to the subreports as well. The following function is for CR version 10
-------------------------------------------------
Private Shared Function SetUserAndPassword(ByRef rp As
CrystalDecisions.CrystalReports.Engine.ReportDocument, _
ByVal ServerName As String, ByVal UserId As String, _
ByVal Password As String, ByVal DatabaseName As String) As
Boolean

Dim li As CrystalDecisions.Shared.TableLogOnInfo, i As Integer
Dim ci As CrystalDecisions.Shared.ConnectionInfo
Dim ReturnCode As Boolean = True

Try
With rp
For i = 0 To .Database.Tables.Count - 1
li = .Database.Tables(i).LogOnInfo
ci = li.ConnectionInfo

ci.ServerName = ServerName
ci.Password = Password
ci.UserID = UserId
ci.DatabaseName = DatabaseName

.Database.Tables(i).ApplyLogOnInfo(li)
Next i
End With

Catch erreur As Exception
' DO something with the error
ReturnCode = False

End Try

Return ReturnCode
End Function
 
Back
Top