<%@ LANGUAGE="VBSCRIPT" %>
<%
Set oConn = server.CreateObject("ADODB.Connection")
oConn.Open session("oSession")
Set oCmd = server.CreateObject("ADODB.Command")
Set session("oRS") = server.CreateObject("ADODB.RecordSet")
'set the report name
reportname = "acme.rpt"
Set session("oRpt") = session("oApp").OpenReport(path & reportname, 1)
sSQL = "exec acme_get_results"
' Set ADO Connection properties
oCmd.ActiveConnection = oConn
oCmd.CommandTimeout = 10000
oCmd.CommandText = sSQL
oCmd.CommandType = 1
' Execute the command and retrieve the record set
Set session("oRS") = oCmd.Execute
' Associate the record set with the reports database tables
Set oRptTable = session("oRpt").Database.Tables.Item(1)
oRptTable.SetPrivateData 3, session("oRS")
' Cleanup any session variables
Set oCmd = Nothing
Set session("oRS") = Nothing
' ... set parameters if applicable
' Open and define the datasource for the subreport
Set CRSubReports = session("oRpt").OpenSubreport("acmesubreport.rpt")
Set oCmd = server.CreateObject("ADODB.Command")
Set session("oRS") = server.CreateObject("ADODB.RecordSet")
sSQL = "exec acme_get_details"
' Set ADO Connection properties
oCmd.ActiveConnection = oConn
oCmd.CommandTimeout = 10000
oCmd.CommandText = sSQL
oCmd.CommandType = 1
' Execute the command and retrieve the record set
Set session("oRS") = oCmd.Execute
' Associate the record set with the reports database tables
CRSubReports.MorePrintEngineErrorMessages = False
CRSubReports.EnableParameterPrompting = False
CRSubReports.DiscardSavedData
Set Database2 = CRSubReports.Database
Set Tables2 = Database2.Tables
Set Table2 = Tables2.Item(1)
Table2.SetPrivateData 3, session("oRS")
' Cleanup any session variables???
Set oCmd = Nothing
Set session("oRS") = Nothing
Set oConn = Nothing
%>
<!-- #INCLUDE FILE="inc/page_engine.inc" -->
<!-- #include file="SmartViewerActiveX.asp" -->