Hello,
I have developed a few crystal reports now I have write an ASP Application which uses the activeXViewer for displaying the report to the client. I have seen some code samples on the web (From
www.businessobjects.com) and tried using the following code but i just get the error message "The Crystal Report Viewer is unable to create its resource objects". Can anyone help me out with this, its very urgent.
i m using crystal report XI,
my browser is IE.6 ... is there i've to set in my browser ??
Can anyone help me out with this its very urgent.
Thanks
Suniti Agrawal
The Code I am trying to use is
1. SimplePreviewReport.asp
<%@ LANGUAGE="VBSCRIPT" %>
<%
reportname = "SimplePreviewReport.rpt"
%>
2. AlwaysRequiredSteps.asp
<%
If Not IsObject (session("oApp")) Then
Set session("oApp") = Server.CreateObject("CrystalRuntime.Application.11 ")
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
On error resume next
Set session("oRpt") = session("oApp").OpenReport(path & reportname, 1)
If Err.Number <> 0 Then
Response.Write "Error Occurred creating Report Object: " & Err.Description
Set Session("oRpt") = nothing
Set Session("oApp") = nothing
Session.Abandon
Response.End
End If
session("oRpt").MorePrintEngineErrorMessages = False
session("oRpt").EnableParameterPrompting = False
'session("oRpt").DiscardSavedData
%>
3. MoreRequiredSteps.asp
<%
session("oRpt").ReadRecords
If Err.Number <> 0 Then
Response.Write "Error Occurred Reading Records: " & Err.Description
Set Session("oRpt") = nothing
Set Session("oApp") = nothing
Session.Abandon
Response.End
Else
If IsObject(session("oPageEngine")) Then
set session("oPageEngine") = nothing
End If
set session("oPageEngine") = session("oRpt").PageEngine
End If
%>
4. SmartViewerActiveX.asp
<HTML>
<HEAD>
<TITLE>Crystal Reports ActiveX Viewer</TITLE>
</HEAD>
<BODY BGCOLOR=C6C6C6 ONUNLOAD="CallDestroy();" leftmargin=0 topmargin=0 rightmargin=0 bottommargin=0>
<OBJECT ID="CRViewer"
CLASSID="CLSID:6F0892F7-0D44-41C3-BF07-7599873FAA04"
WIDTH=50% HEIGHT=50%
CODEBASE="../viewer/ActiveXViewer.cab#Version=11,5,0,261" VIEWASTEXT>
<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 Window_Onload
On Error Resume Next
Dim webBroker
Set webBroker = CreateObject("CrystalReports115.WebReportBroker.1" )
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."
else
Dim webSource
Set webSource = CreateObject("CrystalReports115.WebReportSource.1" )
webSource.ReportSource = webBroker
webSource.URL = "RDCrptserver115.asp"
webSource.PromptOnRefresh = True
CRViewer.ReportSource = webSource
end if
CRViewer.ViewReport
End Sub
-->
</SCRIPT>
<script language="javascript">
function CallDestroy()
{
window.open("Cleanup.asp");
}
</script>
</BODY>
</HTML>