Passing in SubReport Sproc Parameters using ASP

Discussion in 'ASP General' started by Aaron, Aug 14, 2003.

  1. Aaron

    Aaron Guest

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

    -----------------------------------------------------------
     
    Aaron, Aug 14, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UA==?=
    Replies:
    1
    Views:
    2,214
    Michelle Hlaing
    Nov 30, 2004
  2. Chad Micheal Lawson via .NET 247

    SQL 2k - ASP.NET - SPROC - "Input string was not in a correct format."

    Chad Micheal Lawson via .NET 247, Sep 24, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    607
    Greg Burns
    Sep 24, 2004
  3. =?Utf-8?B?c2tpcmtieQ==?=

    Problem using COMPUTE with SPROC on ASP Application

    =?Utf-8?B?c2tpcmtieQ==?=, Nov 1, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    296
    Scott Allen
    Nov 1, 2004
  4. Elmo Watson
    Replies:
    0
    Views:
    413
    Elmo Watson
    Jul 20, 2006
  5. Radu
    Replies:
    7
    Views:
    716
    charlie_Stell
    Aug 28, 2009
Loading...

Share This Page