I have a Crystal Report.Net in an ASP.Net webform. Initially I set the data source of my report document to a dataset generated from a SQL query.
Everything worked fine. Then I added two subreports in the report document that is directly linked to a table in the database.
Now it gives me this error " Logon Exception:
CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed. "
I try to create a procedure like this:
Public Sub LogonToDatabase(ByVal ReportTables As CrystalDecisions.CrystalReports.Engine.Tables, ByVal UserId As String, ByVal Password As String)
Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
Dim myConnectionInfo As New CrystalDecisions.Shared.ConnectionInfo
Dim myLogonInfo As New CrystalDecisions.Shared.TableLogOnInfo
With myConnectionInfo
'.ServerName = "myServer"
.DatabaseName = "mydatabase"
.UserID = UserId
.Password = Password
End With
myLogonInfo.ConnectionInfo = myConnectionInfo
For Each myTable In ReportTables
myTable.ApplyLogOnInfo(myLogonInfo)
Next
End Sub
This doesn't work!
Thanks in advance for any reply!
Everything worked fine. Then I added two subreports in the report document that is directly linked to a table in the database.
Now it gives me this error " Logon Exception:
CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed. "
I try to create a procedure like this:
Public Sub LogonToDatabase(ByVal ReportTables As CrystalDecisions.CrystalReports.Engine.Tables, ByVal UserId As String, ByVal Password As String)
Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
Dim myConnectionInfo As New CrystalDecisions.Shared.ConnectionInfo
Dim myLogonInfo As New CrystalDecisions.Shared.TableLogOnInfo
With myConnectionInfo
'.ServerName = "myServer"
.DatabaseName = "mydatabase"
.UserID = UserId
.Password = Password
End With
myLogonInfo.ConnectionInfo = myConnectionInfo
For Each myTable In ReportTables
myTable.ApplyLogOnInfo(myLogonInfo)
Next
End Sub
This doesn't work!
Thanks in advance for any reply!