Hello
I'm using ASP.NET 3.5 and VB.NET to run a report written in Crystal Reports XI. I'm using the code sample from Brian book, CR .NET 2005/2008. I have used the code sample to run reports that access SQL Server without any problems. Now I need to access an AS400 using OLE DB. I copied the code and changed the logon information to match my AS400 but I keep getting error message that I can't login. If anyone has any ideas as to why its not working, I would appreciate it. Here is my code:
Dim
myReportDocument As New ReportDocument
Protected
Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
Dim ReportName = "myreportList2.rpt"
Dim reportPath As String = Server.MapPath(ReportName)
Dim reportServer As String = Server.MachineName
myReportDocument.Load(reportPath)
CrystalReportViewer1.ReportSource = myReportDocument
CRServer =
"xxx.xxx.x.x"
CRDatabase = ""
CRUser =
"myuser"
CRPassword =
"mypassword"
Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()
myConnectionInfo.ServerName = CRServer
myConnectionInfo.DatabaseName = CRDatabase
myConnectionInfo.UserID = CRUser
myConnectionInfo.Password = CRPassword
SetDBLogonForReport(myConnectionInfo, myReportDocument)
Session(
"myReportDocument") = myReportDocument
CrystalReportViewer1.Visible =
"True"
End Sub
Private Sub SetDBLogonForReport(ByVal myConnectionInfo As ConnectionInfo, ByVal myReportDocument As ReportDocument)
Dim tables As Tables = myReportDocument.Database.Tables
For Each table As CrystalDecisions.CrystalReports.Engine.Table In tables
Dim tableLogOnInfo As TableLogOnInfo = table.LogOnInfo
tableLogOnInfo.ConnectionInfo = myConnectionInfo
table.ApplyLogOnInfo(tableLogOnInfo)
Next
End Sub
Thank you.
Ohioguy_tim