ASP Call Crystal Report with Store Procedure(1)

來源:互聯網
上載者:User
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



相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.