<%@ 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"))'获取报表的所在的路径
If Not IsObject(session("oApp")) Then '返回 Boolean 值指明表达式是否引用了有效的 Automation 对象。
'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/activexviewer.cab#Version=9.2.1.175" height="100%"
width="100%" classid=CLSID:2DEF4530-8CE6-41C9-84B6-A54536C90213>
</OBJECT>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub Page_Initialize
On Error Resume Next
Dim webBroker
Set webBroker = CreateObject("WebReportBroker9.WebReportBroker")
if ScriptEngineMajorVersion < 2 then
window.alert "IE 3.02 users on NT4 need to get the latest version of VBScript or install IE 4.01 SP1. IE 3.02 users on Win95 need DCOM95 and latest version of VBScript, or install IE 4.01 SP1. These files are available at Microsoft's web site."
CRViewer.ReportName = "rptserver.asp"
else
Dim webSource
Set webSource = CreateObject("WebReportSource9.WebReportSource")
webSource.ReportSource = webBroker
webSource.URL = "rptserver.asp"
webSource.PromptOnRefresh = True
CRViewer.ReportSource = webSource
end if
CRViewer.ViewReport
End Sub
-->
</SCRIPT>
</BODY>
</HTML>