• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 509
  • Last Modified:

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
0
Wildone63
Asked:
Wildone63
  • 2
  • 2
1 Solution
 
mlmccCommented:
What connection method are you using for the local database?
Do you have an ODBC connectionto it?

mlmcc
0
 
Wildone63Author Commented:
OLEDB,

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

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

mlmcc
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now