Skip to Content
0
Former Member
Jan 23, 2012 at 02:54 PM

Passing log-in information to CR ?

14 Views

Good Morning (or insert your timezone here),

I am trying to pass username and password onto a report and not having much luck. When it runs it is still asking for username and password. My first thought was that the username/password combo was wrong, but it will log in at this point. So... here is my code if someone could shed some light that would be awesome...

oh and this is pretty much strait from the book...

Private rpt As ReportDocument

        Private Sub ConfigureCrystalReports()
        rpt = New ReportDocument()
        Dim reportPath As String = Server.MapPath("report.rpt")
        rpt.Load(reportPath)
        'rpt.Refresh()
        Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()
        myConnectionInfo.DatabaseName = "database"
        'myConnectionInfo.IntegratedSecurity = True
        myConnectionInfo.UserID = "dbuser"
        myConnectionInfo.Password = "dbpassword"
        myConnectionInfo.ServerName = "dbserver"

        CrystalReportViewer1.RefreshReport()
        CrystalReportViewer1.ReportSource = rpt

    End Sub
    Protected Sub Page_init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        ConfigureCrystalReports()
    End Sub

Thanks in advance,

J

Edited by: jemmett on Jan 23, 2012 3:55 PM