Come from http://support.seagatesoftware.com/
'SimpleStoredProcParam.asp
<%@ LANGUAGE="VBSCRIPT" %>
<title>Crystal Reports ASP Example - Using Stored Procedure Parameters</title>
<%
'==============================================================================
' WORKING WITH THE REPORT DESIGNER COMPONENT AND ASP TO USE STORED PROCEDURES
' AND PASS VALUES TO STORED PROCEDURE PARAMETERS
'==============================================================================
'
' CONCEPT
' The Application object (oApp) is needed so that we can create the
' report object.
' Once we have created the report object (oRpt), we can then
' gain access to such things the "DatabaseParameters" in that
' report.
'
' ALWAYS REQUIRED STEPS (contained in AlwaysRequiredSteps.asp)
' - create the application object
' - create the report object
' - open the report
'
' WORK WITH STORED PROCEDURE PARAMETERS
' - get the database in the report
' - get the database's Stored Procedure Parameters
' - get the specific Store Procedure Parameter
' - save the new value to the Stored Proc Param
'
' MORE ALWAYS REQUIRED STEPS
' - retrieve the records
' - create the page engine
'
' DISPLAY THE REPORT
' - display the report using a smart viewer
' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
'==================================================================
'==================================================================
' ALWAYS REQUIRED STEPS
'
' Include the file AlwaysRequiredSteps.asp which contains the code
' for steps:
' - create the application object
' - create the report object and open the report
%>
<%
' This is the name of the report being used in this example.
' This variable is being used in the AlwaysRequiredSteps.asp
' To use a different report, change it here.
reportname = "SimpleStoredProcParam.rpt"
%>
<!-- #include file="AlwaysRequiredSteps.asp" -->
<%
' If it is easier to understand, simply delete the line above,
' and replace it with the entire contents of the file
' AlwaysRequiredSteps.asp
'==================================================================
'==================================================================
' LOG ONTO THE EXAMPLES SYTEM DSN AGAINST MS SQL SERVER "PUBS" SAMPLE DATABASE
userid = "sa"
Password= ""
session("oRpt").MorePrintEngineErrorMessages = False
session("oRpt").EnableParameterPrompting = False
set crtable = session("oRpt").Database.Tables.Item(1)
crtable.SetLogonInfo "Automation", "pubs", cstr(userid),cstr(Password)
'Create a System DSN called "Automation" pointing to the "pubs" database on SQL Server.
' Add your database's username and password to the SimpleStoredProcParam.asp page where indicated.
'==================================================================
'==================================================================
' 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 ThisParam = StoredProcParamCollection.item(1)
Set ThisParam2 = StoredProcParamCollection.item(2)
Set ThisParam3 = StoredProcParamCollection.item(3)
' - save the new value to the Stored Proc Param
' Create a variable and store the new value for the Stored Procedure
' in