Skip to Content
0
Former Member
Jun 17, 2011 at 02:52 PM

Crystal Report with Classis ASP

630 Views

I am new to both, ASP and Crystal Report, please keep that in mind while replying.

The goal is to use classic ASP to design a webpage through which invoke crystal report, pass parameters, run CR get report and display it in the PDF format.

So I downloaded trial version, for time being, and started learning ASP and CR. While browsing through this forum, I found a code which is supposed to help me in this. I downloaded and tweaked a little, but it is not working. The code is same copied in many forums, people claiming that it is working, but not for me.

The code is divided in various files. Here it goes.

SimpleReportViewer.asp - this is the file called first in browser

<%@ LANGUAGE="VBSCRIPT" %>
<%
reportname = "SimplePreviewReport.rpt"
%>
<!-- #include file="AlwaysRequiredSteps.asp" -->     
<!-- #include file="MoreRequiredSteps.asp" -->
<!-- #include file="SmartViewerActiveX.asp" -->       

Now here is the file - AlwaysRequiredSteps.asp

If Not IsObject (session("oApp")) Then                              
  Set session("oApp") = Server.CreateObject("CrystalReports14.ObjectFactory.1")
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

I am not typing in more code, as the error I am getting is in code above.

Now when I execute this code in IE, the error I am getting is

"Error Occurred creating Report Object: Object doesn't support this property or method"

Please help, any kind of help in getting this running will greatly appreciated