Hello!
I have a problem calling a Crystal Report via ASP. The page was successfully loaded the Crystal Smart Viewer ActiveX. Unfortunately, records were not retrieved and a prompt saying "User Session Has Expired" is visible on my screen.
I am using ADO (Data Definitions Only). During run-time, I set the recordset in replacement for the Data Definitions. My database is a simple Access Database
<%
Set oConn = Server.CreateObject("ADODB.Connection"
oConn.Open "File Name=C:\Winnt\UDL1.udl"
set session("oRs"
= Server.CreateObject("ADODB.Recordset"
session("oRs"
.ActiveConnection = oConn
session("oRs"
.Open "SELECT FIELD1, FIELD2 FROM TABLE1"
reportname = "Report1.rpt"
If Not IsObject (session("oApp"
) Then
Set session("oApp"
= Server.CreateObject("Crystal.CRPE.Application"
End If
Path = Request.ServerVariables("PATH_TRANSLATED"
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)
set session("oRptOptions"
= Session("oRpt"
.Options
session("oRptOptions"
.MorePrintEngineErrorMessages = 0
session("oRpt"
.DiscardSavedData
set Database = session("oRpt"
.Database
set Tables = Database.Tables
set Table1 = Tables.Item(1)
Table1.SetPrivateData 3, session("oRs"
On Error Resume Next
session("oRpt"
.ReadRecords
If Err.Number <> 0 Then
Response.Write err.description & " " & err.number
' Response.Write "An Error has occured on the server in attempting to access the data source " & err.number
Else
If IsObject(session("oPageEngine"
) Then
set session("oPageEngine"
= nothing
End If
set session("oPageEngine"
= session("oRpt"
.PageEngine
End If
%>
<HTML>
<HEAD>
<TITLE>Seagate Crystal Smart Viewer for ActiveX</TITLE>
</HEAD>
<BODY BGCOLOR=C6C6C6 LANGUAGE=VBScript ONLOAD="Page_Initialize">
<OBJECT ID="CRViewer"
CLASSID="CLSID:C4847596-972C-11D0-9567-00A0C9273C2A"
WIDTH=100% HEIGHT=95%
CODEBASE="/viewer/activeXViewer/activexviewer.cab#Version=7,0,100,52">
<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="EnableAnimationControl" VALUE=1>
<PARAM NAME="EnableZoomControl" VALUE=1>
</OBJECT>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub Page_Initialize
On Error Resume Next
Dim webBroker
Set webBroker = CreateObject("WebReportBroker.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 = Location.Protocol + "//" + Location.Host +"/scrreports/rptserver.asp"
else
Dim webSource
Set webSource = CreateObject("WebReportSource.WebReportSource"
webSource.ReportSource = webBroker
webSource.URL = Location.Protocol + "//" + Location.Host + "/scrreports/rptserver.asp"
webSource.PromptOnRefresh = True
CRViewer.ReportSource = webSource
end if
CRViewer.ViewReport
End Sub
-->
</SCRIPT>
</BODY>
</HTML>
What's wrong with this code? Please help me. ASAP!!!
Thanks a lot!![[thumbsup2] [thumbsup2] [thumbsup2]](/data/assets/smilies/thumbsup2.gif)
I have a problem calling a Crystal Report via ASP. The page was successfully loaded the Crystal Smart Viewer ActiveX. Unfortunately, records were not retrieved and a prompt saying "User Session Has Expired" is visible on my screen.
I am using ADO (Data Definitions Only). During run-time, I set the recordset in replacement for the Data Definitions. My database is a simple Access Database
<%
Set oConn = Server.CreateObject("ADODB.Connection"
oConn.Open "File Name=C:\Winnt\UDL1.udl"
set session("oRs"
session("oRs"
session("oRs"
reportname = "Report1.rpt"
If Not IsObject (session("oApp"
Set session("oApp"
End If
Path = Request.ServerVariables("PATH_TRANSLATED"
While (Right(Path, 1) <> "\" And Len(Path) <> 0)
iLen = Len(Path) - 1
Path = Left(Path, iLen)
Wend
If IsObject(session("oRpt"
Set session("oRpt"
End if
Set session("oRpt"
set session("oRptOptions"
session("oRptOptions"
session("oRpt"
set Database = session("oRpt"
set Tables = Database.Tables
set Table1 = Tables.Item(1)
Table1.SetPrivateData 3, session("oRs"
On Error Resume Next
session("oRpt"
If Err.Number <> 0 Then
Response.Write err.description & " " & err.number
' Response.Write "An Error has occured on the server in attempting to access the data source " & err.number
Else
If IsObject(session("oPageEngine"
set session("oPageEngine"
End If
set session("oPageEngine"
End If
%>
<HTML>
<HEAD>
<TITLE>Seagate Crystal Smart Viewer for ActiveX</TITLE>
</HEAD>
<BODY BGCOLOR=C6C6C6 LANGUAGE=VBScript ONLOAD="Page_Initialize">
<OBJECT ID="CRViewer"
CLASSID="CLSID:C4847596-972C-11D0-9567-00A0C9273C2A"
WIDTH=100% HEIGHT=95%
CODEBASE="/viewer/activeXViewer/activexviewer.cab#Version=7,0,100,52">
<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="EnableAnimationControl" VALUE=1>
<PARAM NAME="EnableZoomControl" VALUE=1>
</OBJECT>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub Page_Initialize
On Error Resume Next
Dim webBroker
Set webBroker = CreateObject("WebReportBroker.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 = Location.Protocol + "//" + Location.Host +"/scrreports/rptserver.asp"
else
Dim webSource
Set webSource = CreateObject("WebReportSource.WebReportSource"
webSource.ReportSource = webBroker
webSource.URL = Location.Protocol + "//" + Location.Host + "/scrreports/rptserver.asp"
webSource.PromptOnRefresh = True
CRViewer.ReportSource = webSource
end if
CRViewer.ViewReport
End Sub
-->
</SCRIPT>
</BODY>
</HTML>
What's wrong with this code? Please help me. ASAP!!!
Thanks a lot!
![[thumbsup2] [thumbsup2] [thumbsup2]](/data/assets/smilies/thumbsup2.gif)