ASP 的程式寫起來會比Java 的程式看起來較簡單,下面的範例是一支非常簡單的View Report 程式,一樣也要完成下面五的參數的宣告:
CMS:BOE XI 伺服器電腦主機名稱
Username:使用者帳號
Password:使用者密碼
Authtype:登入系統認證方式,一般設定為secEnterprise 即可
ReportName:報表名稱
其餘程式架構與Java開發方式相同。
ViewReportOnDemand.asp
CMS:BOE XI 伺服器電腦主機名稱
Username:使用者帳號
Password:使用者密碼
Authtype:登入系統認證方式,一般設定為secEnterprise 即可
ReportName:報表名稱
其餘程式架構與Java開發方式相同。
ViewReportOnDemand.asp
| Code: |
<%
Dim CMS
Dim Username
Dim Password
Dim Authtype
CMS = "tom"
Username = "administrator"
Password = ""
Authtype = "secEnterprise"
ReportName = "報表名稱"
Dim oEnterpriseSessionMgr
Dim ceSession
Dim iStore
Set oEnterpriseSessionMgr = Server.CreateObject("CrystalEnterprise.SessionMgr")
Set ceSession = oEnterpriseSessionMgr.Logon(Username, Password, CMS, Authtype)
Set iStore = ceSession.Service("","InfoStore")
Dim Reports
Dim Report
Set Reports = iStore.Query("SELECT SI_ID, SI_NAME FROM CI_INFOOBJECTS WHERE SI_PROGID = 'CrystalEnterprise.Report' and SI_NAME='" + ReportName + "'")
Report = Reports.Item(1).Properties("SI_ID")
Dim rptAppFactory
Dim reportDocument
Set rptAppFactory = iStore.EnterpriseSession.Service("","PSReportFactory")
Set reportDocument = rptAppFactory.OpenReportSource(CInt(Report))
Dim Viewer
Set Viewer = CreateObject("CrystalReports.CrystalReportViewer")
With Viewer
.reportSource = reportDocument
.EnterpriseLogon = iStore.EnterpriseSession
End With
on error resume next
Viewer.ProcessHTTPRequest Request, Response, Session
if err.number <> 0 then
response.write "Failed to view report" & "</BR>"
response.write "error number: " & err.number & "</BR>"
response.write "error description: " & err.description
end if
%>
|
浙公网安备 33010602011771号