Link to home
Start Free TrialLog in
Avatar of Wildone63
Wildone63

asked on

Crystal Reports Login Info

I have several crystal reports that I have put into ASPX pages using the crystal report viewer and crystal report source.

I have two differnet databases, One that I can only get to via ODBC. One that is a local MS-SQL server 2008.

When I launch the reports that use the ODBC/DSN everything works fine. but I can not get to the local Database.

Here is the code behind that I am using to provide the login credentials.

This does not work for local db. The error i get is db login failed. But it works fine in my designer.

    Protected Sub form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles form1.Load
        Dim ConnInfo As New ConnectionInfo

        With ConnInfo
            .ServerName = "web01"
            .DatabaseName = "iwonline"
            .UserID = "sa"
            .Password = "password"

        End With

        For Each cnInfo As TableLogOnInfo In Me.CrystalReportViewer1.LogOnInfo
            cnInfo.ConnectionInfo = ConnInfo
        Next
    End Sub


This DOES work for the DSN connections...

    Protected Sub form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles form1.Load
        Dim ConnInfo As New ConnectionInfo

        With ConnInfo
            .ServerName = "Netsuite.com"
            .DatabaseName = ""
            .UserID = "me@mynet.net"
            .Password = "password"

        End With

        For Each cnInfo As TableLogOnInfo In Me.CrystalReportViewer1.LogOnInfo
            cnInfo.ConnectionInfo = ConnInfo
        Next
    End Sub
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Wildone63
Wildone63

ASKER

OLEDB,

No I do not have an odbc connection to the local db.
I just made an ODBC connection and it works fine.

Thank You.
As far as I knkow you cannot change the connection type for a report at run time.

mlmcc