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.Lo gOnInfo
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.Lo gOnInfo
cnInfo.ConnectionInfo = ConnInfo
Next
End Sub
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.Lo
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.Lo
cnInfo.ConnectionInfo = ConnInfo
Next
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I just made an ODBC connection and it works fine.
Thank You.
Thank You.
As far as I knkow you cannot change the connection type for a report at run time.
mlmcc
mlmcc
ASKER
No I do not have an odbc connection to the local db.