Crystal Report (ASP calls a crystal report instance)

Source: Internet
Author: User
Tags webbroker

<% @ Language = "VBScript" %>
<%
Response. expires =-1
Response. addheader "Pragma", "No-Cache"
Response. addheader "cache-control", "No-store"
'Response. Write ("<script language = JavaScript> alert ('" & job_id & "') </SCRIPT> ")
Reportname = server. mappath (Request ("url") 'obtains the path of the report.

If not isobject (Session ("oapp") then' returns a Boolean value indicating whether the expression references a valid Automation Object.
'Alert ("FDS ");
Set SESSION ("oapp") = server. Createobject ("crystalruntime. application.9 ")
Session ("oapp"). logonserver "pdssql. dll", "127.0.0.1", "Database", "user", "123"
End if

If isobject (Session ("orpt") then
Set SESSION ("orpt") = nothing
End if

Set SESSION ("orpt") = SESSION ("oapp"). openreport (reportname, 1)

Set mainreporttablecollection = SESSION ("orpt"). database. Tables

For each table in mainreporttablecollection
Table. setlogoninfo "127.0.0.1", "shat", "shat_user", "tahs_54321"
Next

Session ("orpt"). moreprintengineerrormessages = false
Session ("orpt"). enableparameterprompting = false

Session ("orpt"). discardsaveddata
Session ("orpt"). recordselectionformula = getdecodestr (Request ("SF "))
'Response. Write "Sf =" & getdecodestr (Request ("SF "))
'Set value for Parameter Field
Strparams = request ("Params ")
Arrparams = Split (strparams ,",")
Set oparamcollection = SESSION ("orpt"). parameterfields
For I = 1 to oparamcollection. Count
If I <= (ubound (arrparams) + 1) then
Set oparam = oparamcollection. Item (I)
Oparam. setcurrentvalue getdecodestr (CSTR (arrparams (I-1), 12
End if
Next

on error resume next
session ("orpt "). readrecords
If err. number <> 0 then
response. write err. description
response. write "an error has occured on the server in attempting to access the data source"
else
If isobject (Session ("opageengine ")) then
set session ("opageengine") = nothing
end if
set session ("opageengine") = SESSION ("orpt "). pageengine
end if
%>

<HTML>
<Head>
<Title> report viewer </title>
<Base target = "_ Self">
<Script language = "jscript. encode" runat = "server" src = "_ xform_library/basic. js"> </SCRIPT>
</Head>
<Body bgcolor = # c6c6c6 Language = VBScript onload = "page_initialize" style = "border-style: none" bottommargin = 0 leftmargin = 0 topmargin = 0 rightmargin = 0 scroll = NO>

<Object ID = crviewer style = "height: 100%"
Codebase = "/Viewer/activexviewer. Cab # version = 9.2.1.175" Height = "100%"
Width = "100%" classid = CLSID: 2def4530-8ce6-41c9-84b6-a54536c90213>

</Object>


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.