Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CR9 subreport dataset not passing through

Status
Not open for further replies.

SuzyJJ

Programmer
Jul 1, 2003
3
AU
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) <> &quot;\&quot; 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(&quot;oRpt&quot;)) then
Set session(&quot;oRpt&quot;) = nothing
End if

Set session(&quot;oRpt&quot;) = session(&quot;oApp&quot;).OpenReport(path & Reportname, 1)

session(&quot;oRpt&quot;).MorePrintEngineErrorMessages = False
session(&quot;oRpt&quot;).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(&quot;oRpt&quot;).database.tables.item(1)
crtable.setlogoninfo Application(&quot;sSqlServerConnection&quot;),Session(&quot;sSqlServerDatabase&quot;),Session(&quot;sSqlServerId&quot;), Session(&quot;sSqlServerPWD&quot;)

'****************************************************************************************
'Primary Report

set Database = session(&quot;oRpt&quot;).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(&quot;oRpt&quot;).DiscardSavedData

Table1.SetPrivateData 3, session(&quot;oRs&quot;)

'*****************************************************************************************
' Subreport # 1

Set session(&quot;ors2&quot;) = Server.CreateObject(&quot;ADODB.Recordset&quot;)
session(&quot;ors2&quot;).Open sSql1, oConn

Set CRSubreports = session(&quot;oRpt&quot;).OpenSubreport(&quot;RefDetails1&quot;)
set crtable2 = CRSubreports.database.tables.item(1)

crtable2.setlogoninfo Application(&quot;sSqlServerConnection&quot;), Session(&quot;sSqlServerDatabase&quot;), Session(&quot;sSqlServerId&quot;), Session(&quot;sSqlServerPWD&quot;)

Set Database2 = CRSubreports.Database
set Tables2 = Database2.Tables
set Table2 = Tables2.Item(1)
CRSubreports.DiscardSavedData

Table2.SetPrivateData 3, session(&quot;ors2&quot;)

'*****************************************************************************************

On Error Resume Next
session(&quot;oRpt&quot;).ReadRecords
If Err.Number <> 0 Then
Response.Write &quot;An Error has occured on the server in attempting to access the data source&quot; & Err.Description
Else
If IsObject(session(&quot;oPageEngine&quot;)) Then
set session(&quot;oPageEngine&quot;) = nothing
End If
set session(&quot;oPageEngine&quot;) = session(&quot;oRpt&quot;).PageEngine
End


Any ideas??
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top