Skip to Content
0
Former Member
Dec 12, 2015 at 02:53 AM

Logon Prompt with Crystal Reports for VS 2008 on Windows Server 2012/IIS 8.5

76 Views

We are attempting to get Crystal reports for Visual Studio 2008 to run on our 2012 Server in an ASP.net web application. It is connecting to a SQL 2005 database. Every time we load the report into the Report Viewer it asks from database credentials. I have tried to load the connection parameters via code, but it does not make a difference. I've tried looping through all of the tables in the report + subreports to set the logon parameters to no avail. It still asks me to enter the login info. Plus, the information that I entered in code, does not show up in the prompts.

Here's a screenshot of the prompt:

Here is the code:

Protected cryRpt As New ReportDocument

Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
        crvRequest.ReportSource = ""
        SetReportOptions("TempTest.rpt")
End Sub
   

Protected Sub SetReportOptions(ByVal reportName As String)

        Dim crconnectioninfo As New ConnectionInfo()
        Dim crtablelogoninfos As New TableLogOnInfos()
        Dim crtablelogoninfo As New TableLogOnInfo()

        crconnectioninfo.ServerName = "dbserver"
        crconnectioninfo.DatabaseName = "hhqualitycontrol"
        crconnectioninfo.UserID = "kjpdmsuser"
        crconnectioninfo.Password = "kjpdmspassword1"
        crconnectioninfo.IntegratedSecurity = False

        cryRpt.Load(Server.MapPath(".") & "\" & reportName)


        For Each CrTable As CrystalDecisions.CrystalReports.Engine.Table In cryRpt.Database.Tables
            crtablelogoninfo = CrTable.LogOnInfo
            crtablelogoninfo.ConnectionInfo = crconnectioninfo
            CrTable.ApplyLogOnInfo(crtablelogoninfo)
        Next
        For Each subreport As ReportDocument In cryRpt.Subreports
            For Each CrTable As CrystalDecisions.CrystalReports.Engine.Table In subreport.Database.Tables
                crtablelogoninfo = CrTable.LogOnInfo
                crtablelogoninfo.ConnectionInfo = crconnectioninfo
                CrTable.ApplyLogOnInfo(crtablelogoninfo)
            Next
        Next


        crvRequest.ReportSource = cryRpt

End Sub










I don't care if I use Integrated Security or SQL security. I just want it to stop asking for the logon parameters.

Another note on the prompt:

When it shows the prompt, I'm not able to set the Database name field. Because of this I can't properly even connect to the database using the prompt.

Thanks,

Eric

Attachments

image002.jpg (8.3 kB)