Passing in SubReport Sproc Parameters using ASP

A

Aaron

The following code works fine when previewing a Crystal report using
ASP, EXCEPT when it gets to a report using a SubReport and its
associated parameters. The whole report just comes up blank with this
error message: "The Error Message was: Error detected by database
DLL.from: Crystal Reports ActiveX Designer".

What am I doing wrong in the SubReport section below and how do I
properly pass in sproc params to the subreport? Thanks.

------------------------------------------------------------

<%@ LANGUAGE="VBSCRIPT" %>
<title>Make Report</title>

<%
reportname = "\Reports\" & request("ReportName")
%>

<!-- #include file="AlwaysRequiredSteps.asp" -->

<%

userid = "userid"
Password= "pwd"

session("oRpt").MorePrintEngineErrorMessages = False
session("oRpt").EnableParameterPrompting = False

set crtable = session("oRpt").Database.Tables.Item(1)
crtable.SetLogonInfo "SERVER", "DB", cstr(userid),cstr(Password)

'==================================================================
' WORK WITH STORED PROCEDURE PARAMETERS

' - get the database's Stored Procedure Parameters
' Create a variable and point it to the Stored Procedure Parameter
' in the report

set StoredProcParamCollection = Session("oRpt").ParameterFields

' - get the specific Store Procedure Parameter
' Create a variable and point it to the specific stored procedure
' that we want to work on

Set Param1 = StoredProcParamCollection.item(1)
Set Param2 = StoredProcParamCollection.item(2)

' Save the new value for the Stored Procedure in the Store Procedure

Param1.SetCurrentValue cstr((request("Program"))), 12
Param2.SetCurrentValue cstr((request("Client"))), 12

'==================================================================
''' ** Check for SubReport here
'==================================================================
if (request("SubReportName"))<>"-1" then

'Open the subreport - This creates a subreport object
Set CRSubreports = session("oRpt").OpenSubreport(cstr((request("SubReportName"))))

userid = "userid"
Password= "pwd"

session("oRpt").MorePrintEngineErrorMessages = False
session("oRpt").EnableParameterPrompting = False

' Create Database object
set ReportDatabase2 = CRSubreports.Database

'Database Table collection
Set crdatabasetables2 = ReportDatabase2.tables

set crtable2 = crdatabasetables2.Item(1)
crtable2.SetLogonInfo "SERVER", "DB", cstr(userid),cstr(Password)

'==================================================================
' WORK WITH STORED PROCEDURE PARAMETERS

' - get the database's Stored Procedure Parameters
' Create a variable and point it to the Stored Procedure Parameter
' in the report

set StoredProcParamCollection = Session("oRpt").ParameterFields

' - get the specific Store Procedure Parameter
' Create a variable and point it to the specific stored procedure
' that we want to work on

Set subParam1 = StoredProcParamCollection.item(1)
Set subParam2 = StoredProcParamCollection.item(2)

subParam1.SetCurrentValue cstr((request("Program"))), 12
subParam2.SetCurrentValue cstr((request("Client"))), 12

end if

%>
<!-- #include file="MoreRequiredSteps.asp" -->
<!-- #include file="SmartViewerActiveX.asp" -->

-----------------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top