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 SetUserAndPassw ord(ByRef rp As
CrystalDecision s.CrystalReport s.Engine.Report Document, _
ByVal ServerName As String, ByVal UserId As String, _
ByVal Password As String, ByVal DatabaseName As String) As
Boolean
Dim li As CrystalDecision s.Shared.TableL ogOnInfo, i As Integer
Dim ci As CrystalDecision s.Shared.Connec tionInfo
Dim ReturnCode As Boolean = True
Try
With rp
For i = 0 To .Database.Table s.Count - 1
li = .Database.Table s(i).LogOnInfo
ci = li.ConnectionIn fo
ci.ServerName = ServerName
ci.Password = Password
ci.UserID = UserId
ci.DatabaseName = DatabaseName
.Database.Table s(i).ApplyLogOn Info(li)
Next i
End With
Catch erreur As Exception
' DO something with the error
ReturnCode = False
End Try
Return ReturnCode
End Function
--------------------------------------------------------
"Michael O'Donnell" wrote:
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