Dimondwoof
Programmer
I have several CR reports (built in version 9) in a VB.NET project. They were all originally developed pointing to our development database. Now that I try to change their connection to the live database, they still bring up the data from the development database. When I move them to the customer site, they all print with no data at all.
The code that I'm using to set the connection is:
Public Function SetReportConnection(ByVal oRpt As ReportDocument) As ReportDocument
Try
Dim crLogonInfo As CrystalDecisions.Shared.TableLogOnInfo
crLogonInfo = oRpt.Database.Tables(0).LogOnInfo
crLogonInfo.ConnectionInfo.ServerName = clsSQLLogin.strServerName
crLogonInfo.ConnectionInfo.UserID = clsSQLLogin.strUserName
crLogonInfo.ConnectionInfo.Password = clsSQLLogin.strPassWord
crLogonInfo.ConnectionInfo.DatabaseName = clsSQLLogin.strDB
oRpt.Database.Tables(0).ApplyLogOnInfo(crLogonInfo)
SetReportConnection = oRpt
Catch ex As Exception
MessageBox.Show("SetReportConnection - " & ex.Message & ex.GetType.ToString)
End Try
End Function
This appears to work, in that when I step through the code, the crLogonInfo.ConnectionInfo.DatabaseName shows as the correct database, but the data that is bring displayed on the report is definately from the development database.
Does anyone have any ideas as to what I'm doing wrong?
The code that I'm using to set the connection is:
Public Function SetReportConnection(ByVal oRpt As ReportDocument) As ReportDocument
Try
Dim crLogonInfo As CrystalDecisions.Shared.TableLogOnInfo
crLogonInfo = oRpt.Database.Tables(0).LogOnInfo
crLogonInfo.ConnectionInfo.ServerName = clsSQLLogin.strServerName
crLogonInfo.ConnectionInfo.UserID = clsSQLLogin.strUserName
crLogonInfo.ConnectionInfo.Password = clsSQLLogin.strPassWord
crLogonInfo.ConnectionInfo.DatabaseName = clsSQLLogin.strDB
oRpt.Database.Tables(0).ApplyLogOnInfo(crLogonInfo)
SetReportConnection = oRpt
Catch ex As Exception
MessageBox.Show("SetReportConnection - " & ex.Message & ex.GetType.ToString)
End Try
End Function
This appears to work, in that when I step through the code, the crLogonInfo.ConnectionInfo.DatabaseName shows as the correct database, but the data that is bring displayed on the report is definately from the development database.
Does anyone have any ideas as to what I'm doing wrong?