Skip to Content
0
Former Member
Jun 29, 2009 at 08:17 PM

Subreport not displaying when report directed to staging database

106 Views

I am using Crystal Reports version 10.2.3600.0 with VB.Net 2005.

I have code that sets the datasource for the report (shown below) using buisness objects and it works fine until I change the datasoure to our staging database, the databases are identical. The subreport doesn't display and when I look at the SQL trace no parameters are passed to the stored procedure. The subreport is linked to data in the main report and both are using SQL stored procedures.

FLOW:

When report is run against database that it is developed against (it still executes the code below) the report and subreport display correctly and the SQL trace shows the link parameters being passed.

When report is directed to run against the staging database the main report displays correctly but the subreport does not display data and the SQL trace shows the link parameters are null.

Dim crConnectionInfo As ConnectionInfo = New ConnectionInfo

With crConnectionInfo

.ServerName = BusinessObject.DBServer

.DatabaseName = BusinessObject.Database

.UserID = BusinessObject.UserName

.Password = BusinessObject.Password

End With

Return crConnectionInfo

Protected Sub SetLogonForReport(ByVal connInfo As ConnectionInfo, ByVal reportDoc As ReportDocument)

Dim reportTables As Tables = reportDoc.Database.Tables

Dim reportTable As CrystalDecisions.CrystalReports.Engine.Table

For Each reportTable In reportTables

Dim reportTableLogonInfo As TableLogOnInfo = reportTable.LogOnInfo

reportTableLogonInfo.ConnectionInfo = connInfo

reportTable.ApplyLogOnInfo(reportTableLogonInfo)

reportTable.Location = reportTable.Location.Substring(reportTable.Location.LastIndexOf(".") + 1)

Next

' if this is the main report, pass logon info to subreports if any

If Not reportDoc.IsSubreport Then

Dim subRpt As ReportDocument

For Each subRpt In reportDoc.Subreports

SetDBLogonForReport(connInfo, subRpt)

Next

End If

Any thoughts on why the subreport will not display when pointed to staging database or why the link parameters are not being passed?