Hello
whenever i am opening a report using asp
i am getting an error
"Server has not yet been opened."
i just pasted my ASP code below
pl try to help me to come out of this problem
'===================================================='
<%
reportname = "sumpagedone.rpt"
dim oApp
dim oRpt
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
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
Response.End
End If
Session("oRpt".MorePrintEngineErrorMessages = False
Session("oRpt".EnableParameterPrompting = False
Session("oRpt".DiscardSavedData
set session("ParamCollection" = Session("oRpt".Parameterfields
set Param1 = session("ParamCollection".Item(1)
Call Param1.SetCurrentValue (CStr("1", 12)
set Param2 =session("ParamCollection".Item(2)
Call Param2.SetCurrentValue (CStr("2001", 12)
set Param4 =session("ParamCollection".Item(4)
Call Param4.SetCurrentValue (CStr("1", 12)
On Error Resume Next
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
'viewer = Request.Form("Viewer"
viewer = ActiveX
If cstr(viewer) = "ActiveX" then
%>
<!-- #include virtual="/asp_include/SmartViewerActiveX.asp" -->
<%
ElseIf cstr(viewer) = "Netscape Plug-in" then
%>
<!-- #include virtual="/asp_include/ActiveXPluginViewer.asp" -->
<%
ElseIf cstr(viewer) = "Java using Browser JVM" then
%>
<!-- #include virtual="/asp_include/SmartViewerJava.asp" -->
<%
ElseIf cstr(viewer) = "Java using Java Plug-in" then
%>
<!-- #include virtual="/asp_include/JavaPluginViewer.asp" -->
<%
ElseIf cstr(viewer) = "HTML Frame" then
Response.Redirect("/asp_include/htmstart.asp"
Else
Response.Redirect("/asp_include/rptserver.asp"
End If
%>
'===========================================================
Thank You
sbind77
whenever i am opening a report using asp
i am getting an error
"Server has not yet been opened."
i just pasted my ASP code below
pl try to help me to come out of this problem
'===================================================='
<%
reportname = "sumpagedone.rpt"
dim oApp
dim oRpt
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
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
Response.End
End If
Session("oRpt".MorePrintEngineErrorMessages = False
Session("oRpt".EnableParameterPrompting = False
Session("oRpt".DiscardSavedData
set session("ParamCollection" = Session("oRpt".Parameterfields
set Param1 = session("ParamCollection".Item(1)
Call Param1.SetCurrentValue (CStr("1", 12)
set Param2 =session("ParamCollection".Item(2)
Call Param2.SetCurrentValue (CStr("2001", 12)
set Param4 =session("ParamCollection".Item(4)
Call Param4.SetCurrentValue (CStr("1", 12)
On Error Resume Next
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
'viewer = Request.Form("Viewer"
viewer = ActiveX
If cstr(viewer) = "ActiveX" then
%>
<!-- #include virtual="/asp_include/SmartViewerActiveX.asp" -->
<%
ElseIf cstr(viewer) = "Netscape Plug-in" then
%>
<!-- #include virtual="/asp_include/ActiveXPluginViewer.asp" -->
<%
ElseIf cstr(viewer) = "Java using Browser JVM" then
%>
<!-- #include virtual="/asp_include/SmartViewerJava.asp" -->
<%
ElseIf cstr(viewer) = "Java using Java Plug-in" then
%>
<!-- #include virtual="/asp_include/JavaPluginViewer.asp" -->
<%
ElseIf cstr(viewer) = "HTML Frame" then
Response.Redirect("/asp_include/htmstart.asp"
Else
Response.Redirect("/asp_include/rptserver.asp"
End If
%>
'===========================================================
Thank You
sbind77