I am in the process of upgrading my reports from CR7 to CR9, and the asp that calls them.
The reports are called from asp objects and viewed using the SmartViewerJava.
I am passing recordsets to the report.
The reports have been converting over ok, until one report which contained a subreport.
I am attempting to pass throught a recordset for the main report, and a record set for the subreport.
The subreport uses both details from the main record set and details from the secondary record set. The subreport is being displayed however the feilds which are sourced from the secondary dataset are not being displayed.
Here is the code i am using -
Set session("ors" = Server.CreateObject("ADODB.Recordset"
session("ors".Open sSql, oConn
Reportname = "ACInv.rpt"
' CREATE THE APPLICATION OBJECT
If Not IsObject (session("oApp") Then
Set session("oApp" = Server.CreateObject("CrystalRuntime.Application.9"
End If
' CREATE THE REPORT OBJECT
'
'The Report object is created by calling the Application object's OpenReport method.
Path = Request.ServerVariables("PATH_TRANSLATED"
While (Right(Path, 1) <> "\" And Len(Path) <> 0)
iLen = Len(Path) - 1
Path = Left(Path, iLen)
Wend
'OPEN THE REPORT (but destroy any previous one first)
If IsObject(session("oRpt") then
Set session("oRpt" = nothing
End if
Set session("oRpt" = session("oApp".OpenReport(path & Reportname, 1)
session("oRpt".MorePrintEngineErrorMessages = False
session("oRpt".EnableParameterPrompting = False
'****************************************************************************************
' Satisfy the report's requirement for an ODBC connection, although this won't be used by' the report, the interface needs it. It'll fall over with some obscure error if it's not
' included
set crtable=session("oRpt".database.tables.item(1)
crtable.setlogoninfo Application("sSqlServerConnection",Session("sSqlServerDatabase",Session("sSqlServerId", Session("sSqlServerPWD"
'****************************************************************************************
'Primary Report
set Database = session("oRpt".Database
'Instantiates a database collection which references the database(s) used in the report.
set Tables = Database.Tables
'Instantiates a Tables collection which references the Tables of the Database object.
set Table1 = Tables.Item(1)
'Instantiates a table object which references the first table used in the report.
session("oRpt".DiscardSavedData
Table1.SetPrivateData 3, session("oRs"
'*****************************************************************************************
' Subreport # 1
Set session("ors2" = Server.CreateObject("ADODB.Recordset"
session("ors2".Open sSql1, oConn
Set CRSubreports = session("oRpt".OpenSubreport("RefDetails1"
set crtable2 = CRSubreports.database.tables.item(1)
crtable2.setlogoninfo Application("sSqlServerConnection", Session("sSqlServerDatabase", Session("sSqlServerId", Session("sSqlServerPWD"
Set Database2 = CRSubreports.Database
set Tables2 = Database2.Tables
set Table2 = Tables2.Item(1)
CRSubreports.DiscardSavedData
Table2.SetPrivateData 3, session("ors2"
'*****************************************************************************************
On Error Resume Next
session("oRpt".ReadRecords
If Err.Number <> 0 Then
Response.Write "An Error has occured on the server in attempting to access the data source" & Err.Description
Else
If IsObject(session("oPageEngine") Then
set session("oPageEngine" = nothing
End If
set session("oPageEngine" = session("oRpt".PageEngine
End
Any ideas??
The reports are called from asp objects and viewed using the SmartViewerJava.
I am passing recordsets to the report.
The reports have been converting over ok, until one report which contained a subreport.
I am attempting to pass throught a recordset for the main report, and a record set for the subreport.
The subreport uses both details from the main record set and details from the secondary record set. The subreport is being displayed however the feilds which are sourced from the secondary dataset are not being displayed.
Here is the code i am using -
Set session("ors" = Server.CreateObject("ADODB.Recordset"
session("ors".Open sSql, oConn
Reportname = "ACInv.rpt"
' CREATE THE APPLICATION OBJECT
If Not IsObject (session("oApp") Then
Set session("oApp" = Server.CreateObject("CrystalRuntime.Application.9"
End If
' CREATE THE REPORT OBJECT
'
'The Report object is created by calling the Application object's OpenReport method.
Path = Request.ServerVariables("PATH_TRANSLATED"
While (Right(Path, 1) <> "\" And Len(Path) <> 0)
iLen = Len(Path) - 1
Path = Left(Path, iLen)
Wend
'OPEN THE REPORT (but destroy any previous one first)
If IsObject(session("oRpt") then
Set session("oRpt" = nothing
End if
Set session("oRpt" = session("oApp".OpenReport(path & Reportname, 1)
session("oRpt".MorePrintEngineErrorMessages = False
session("oRpt".EnableParameterPrompting = False
'****************************************************************************************
' Satisfy the report's requirement for an ODBC connection, although this won't be used by' the report, the interface needs it. It'll fall over with some obscure error if it's not
' included
set crtable=session("oRpt".database.tables.item(1)
crtable.setlogoninfo Application("sSqlServerConnection",Session("sSqlServerDatabase",Session("sSqlServerId", Session("sSqlServerPWD"
'****************************************************************************************
'Primary Report
set Database = session("oRpt".Database
'Instantiates a database collection which references the database(s) used in the report.
set Tables = Database.Tables
'Instantiates a Tables collection which references the Tables of the Database object.
set Table1 = Tables.Item(1)
'Instantiates a table object which references the first table used in the report.
session("oRpt".DiscardSavedData
Table1.SetPrivateData 3, session("oRs"
'*****************************************************************************************
' Subreport # 1
Set session("ors2" = Server.CreateObject("ADODB.Recordset"
session("ors2".Open sSql1, oConn
Set CRSubreports = session("oRpt".OpenSubreport("RefDetails1"
set crtable2 = CRSubreports.database.tables.item(1)
crtable2.setlogoninfo Application("sSqlServerConnection", Session("sSqlServerDatabase", Session("sSqlServerId", Session("sSqlServerPWD"
Set Database2 = CRSubreports.Database
set Tables2 = Database2.Tables
set Table2 = Tables2.Item(1)
CRSubreports.DiscardSavedData
Table2.SetPrivateData 3, session("ors2"
'*****************************************************************************************
On Error Resume Next
session("oRpt".ReadRecords
If Err.Number <> 0 Then
Response.Write "An Error has occured on the server in attempting to access the data source" & Err.Description
Else
If IsObject(session("oPageEngine") Then
set session("oPageEngine" = nothing
End If
set session("oPageEngine" = session("oRpt".PageEngine
End
Any ideas??