Crystal Report Viewer

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chris

    #1

    Crystal Report Viewer

    Hello,

    I'm new to Crystal Reports and I am having a problem with a login box
    showing up when I try to view a report in the report viewer. I have found
    the following code, listed below, to bypass the login prompt however I am
    not sure how to apply this to the report.

    Thnak you

    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
    --------------------------------------------------------
Working...