Hi, I have developed a simple application in which I am opening a crystal report in my ASP page. My problem is that the crystal report viewer opens but it is not able to open the specific crystal report. Only the viewer opens. Help given will be appreciated. Thanks in advance: I am using the following code: ----------------------------------- <%@ LANGUAGE="VBSCRIPT" %> <title></title> <% '======================================================================= ' WORKING WITH THE REPORT DESIGNER COMPONENT AND ASP TO PREVIEW A REPORT '======================================================================= reportname = "crystalset.rpt" ' - 1 - ' CREATE THE APPLICATION OBJECT If Not IsObject (session("oApp")) Then Set session("oApp") = Server.CreateObject("CrystalRuntime.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 'Response.Write path & "report\" & reportname 'Response.End 'session("oApp").LogonServer "PDSODBC.DLL", Cstr("GEMSquotetest"), Cstr("REWARDS_SCALING"), Cstr("RWDTSTS1"), "Scaling2002" Set session("oRpt") = session("oApp").OpenReport(path & reportname, 1) 'Session("oRpt").ParameterFields.GetItemByName("RTQNumber").AddCurrentValue(CStr("tedCORPRHOgq531")) 'This Section suppress the subreport area dynamically Dim RptSection Dim supSection Dim SectionOptions 'Get Report Section collection object 'Set RptSection = Session("oRpt").sections session("oRpt").MorePrintEngineErrorMessages = False session("oRpt").EnableParameterPrompting = False '==================================================================================== ' Retrieve the Records and Create the "Page on Demand" Engine Object '==================================================================================== On Error Resume Next session("oRpt").ReadRecords 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("oPageEngine")) Then set session("oPageEngine") = nothing End If set session("oPageEngine") = session("oRpt").PageEngine End If %> <!-- #include file="SmartViewerActiveX.asp" -->
I am using Crystal Report 8. Here is my code for SmartActiveX.asp ----------------------------------------- <% if UCase(Request.ServerVariables("HTTPS")) = "ON" Then strAppPath = "https://" else strAppPath = "http://" end if strAppPath = strAppPath + Request.ServerVariables("SERVER_NAME") strAppPath = strAppPath + Request.ServerVariables("URL") ' Strip off the file portion of the URL to get the application path While (Right(strAppPath, 1) <> "/" And Len(strAppPath) <> 0) iLen = Len(strAppPath) - 1 strAppPath = Left(strAppPath, iLen) Wend ' strAppPath now contains the full URL path to this TIS application. This is ' required to set up full references in the following code. ' Create the path to the Crystal ActiveX Viewer cabinet file. strCrxCabPath = "http://" + Request.ServerVariables("SERVER_NAME") strCrxCabPath = strCrxCabPath + "/viewer/activeXViewer/activexviewer.cab" ' The code to set up the ActiveX viewer has been modified from the Crystal ' default to ensure server independence and to allow the control to run in ' Visual InterDev debug mode. %> <!--#INCLUDE FILE="IncClearCache.asp"--> <HTML> <HEAD> <TITLE>Seagate ActiveX Viewer</TITLE> </HEAD> <BODY BGCOLOR=#FFFFFF LANGUAGE=VBScript ONLOAD="Page_Initialize"> <script language="javascript"> var valId;var itype;var valHeight; var valWidth;var valClassid;var valReportName; var valCodebase = '<% Response.Write strCrxCabPath%>' + '#Version=8,0,0,371'; valReportName = '<% Response.Write strAppPath%>rptserver.asp'; valId = 'CRViewer'; valHeight = '100%'; valWidth = '100%'; valClassid = 'CLSID:C4847596-972C-11D0-9567-00A0C9273C2A'; itype = 4; </script> <script src="D:\fisadmin2\HideControlTip.js" language="jscript"></script> <!--<OBJECT ID="CRViewer" CLASSID="CLSID:C4847596-972C-11D0-9567-00A0C9273C2A" WIDTH=100% HEIGHT=100% <% Response.Write "codebase=" + chr(34) + strCrxCabPath%>#Version=8,0,0,371"> <PARAM NAME="ReportName" VALUE=<%Response.Write chr(34) + strAppPath%>rptserver.asp<%Response.Write chr(34)%>> <PARAM NAME="EnableRefreshButton" VALUE=0> <PARAM NAME="EnableGroupTree" VALUE=0> <PARAM NAME="DisplayGroupTree" VALUE=0> <PARAM NAME="EnablePrintButton" VALUE=1> <PARAM NAME="EnableExportButton" VALUE=1> <PARAM NAME="EnableDrillDown" VALUE=0> <PARAM NAME="EnableSearchControl" VALUE=1> <PARAM NAME="EnableAnimationControl" VALUE=1> <PARAM NAME="EnableZoomControl" VALUE=1> </OBJECT>--> <% ' The following code has been adapted from Crystal supplied code to ensure that ' the report server can be referenced fully without problems that may occur ' with relative paths. %> <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 = "<%Response.Write strAppPath%>rptserver.asp" else Dim webSource Set webSource = CreateObject("WebReportSource.WebReportSource") webSource.ReportSource = webBroker webSource.URL = "<%Response.Write strAppPath%>rptserver.asp" webSource.PromptOnRefresh = False CRViewer.ReportSource = webSource end if CRViewer.ViewReport End Sub --> </SCRIPT> </BODY> </HTML>