By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,652 Members | 1,182 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,652 IT Pros & Developers. It's quick & easy.

Passing in SubReport Sproc Parameters using ASP

P: n/a
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("SubRe portName"))))

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" -->

-----------------------------------------------------------
Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.