Hi,
After I installed microsoft personal web server in my machine, I developed a web application using asp technology. Now I am tring to display a crystal report from an asp page by performing the following steps:
1. install Crystal Report 8.0(complete version) in my machine;
2. create a crystal report and put the report(name: RptInventory.rpt) in the same website home directory;
3. "call" the report using the following code.
However it does not work. Could anyone tell me why? Do I need to do something else except the above steps?
Any response is highly appreciated!
Lina
reportname="RptInventory.r
pt"
if not isobject(session("oApp")) then
set session("oApp")=server.Cre
ateObject(
"CrystalRu
ntime.appl
ication")
end if
Path = Request.ServerVariables("P
ATH_TRANSL
ATED")
While (Right(Path, 1) <> "\" And Len(Path) <> 0)
iLen = Len(Path) - 1
Path = Left(Path, iLen)
Wend
If IsObject(session("oRpt")) then
Set session("oRpt") = nothing
End if
Set session("oRpt") = session("oApp").OpenReport
(path & reportname, 1)
session("oRpt").MorePrintE
ngineError
Messages = False
session("oRpt").EnablePara
meterPromp
ting = False
session("oRpt").DiscardSav
edData
set session("ParamCollection")
= Session("oRpt").Parameterf
ields
'set Param1 = session("ParamCollection")
.Item(1)
'set Param2 = session("ParamCollection")
.Item(2)
'ParamValue = Request.Form("SelectedCoun
try")
'Call Param1.SetCurrentValue (CStr(ParamValue), 12)
'ParamValue = Request.Form("TitleString"
)
'Call Param2.SetCurrentValue (CStr(ParamValue), 12)
On Error Resume Next
session("oRpt").ReadRecord
s
If Err.Number <> 0 Then
Response.Write "An Error has occured on the server in attempting to access the data source"
Else
If IsObject(session("oPageEng
ine")) Then
set session("oPageEngine") = nothing
End If
set session("oPageEngine") = session("oRpt").PageEngine
End If
%>
<HTML>
<HEAD>
<TITLE>Seagate ActiveX Viewer</TITLE>
</HEAD>
<BODY BGCOLOR=C6C6C6 LANGUAGE=VBScript ONLOAD="Page_Initialize">
<OBJECT ID="CRViewer"
CLASSID="CLSID:C4847596-97
2C-11D0-95
67-00A0C92
73C2A"
WIDTH=100% HEIGHT=95%
CODEBASE="/viewer/activeXV
iewer/acti
vexviewer.
cab#Versio
n=8,0,0,22
4">
<PARAM NAME="EnableRefreshButton"
VALUE=1>
<PARAM NAME="EnableGroupTree" VALUE=1>
<PARAM NAME="DisplayGroupTree" VALUE=1>
<PARAM NAME="EnablePrintButton" VALUE=1>
<PARAM NAME="EnableExportButton" VALUE=1>
<PARAM NAME="EnableDrillDown" VALUE=1>
<PARAM NAME="EnableSearchControl"
VALUE=1>
<PARAM NAME="EnableAnimationContr
ol" VALUE=1>
<PARAM NAME="EnableZoomControl" VALUE=1>
</OBJECT>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub Page_Initialize
On Error Resume Next
Dim webBroker
Set webBroker = CreateObject("WebReportBro
ker.WebRep
ortBroker"
)
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("WebReportSou
rce.WebRep
ortSource"
)
webSource.ReportSource = webBroker
webSource.URL = "
http://eugtrip1/aspxmps8/test/CrystalQueryReports/rptserver.asp"
webSource.PromptOnRefresh = True
CRViewer.ReportSource = webSource
end if
CRViewer.ViewReport
End Sub
-->
</SCRIPT>
</html>