Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'Server has not yet been opened' error

Status
Not open for further replies.

jeniheaton

Programmer
Sep 2, 2003
2
US
Hello all. My question is that i'm getting an error saying my server has not yet been opened.. when i've already opened it. Here is my code. (mostly from the crystal samples i downloaded) This code comes from 4 pages all included.. i have put the bulk of the code here for simplicity sake. I have a virtual directory and all that. User permissions are correct. Using a sql db. My report gives the correct data when running in crystal. I'm using crystal 8.5. Sorry about all the code.. but i wanted to make sure i wasn't missing anything! its almost like the page with the error doesn't know its connected.. or maybe its a CRAXDRT.dll problem.. but i checked the registry.. that its the right version.. in the right location and all that. I checked it with displaying comments. I really am stumped!

'_________________________________________________________________
<%@ LANGUAGE=&quot;VBSCRIPT&quot; %>
<%
response.write &quot;IN SIMPLE PREV RPT&quot; + &quot;<br>&quot;

response.write &quot;reportname before set&quot; + &quot;<br>&quot;
reportname = &quot;SimplePreviewReport3.rpt&quot;
response.write &quot;reportname after set&quot; + &quot;<br>&quot;

Dim oRS
Dim sTemp
Dim cn
Dim cmd
Dim provStr

response.write &quot;before connect string&quot; + &quot;<br>&quot;
set cn = Server.CreateObject(&quot;ADODB.Connection&quot;)
set cmd = server.createobject(&quot;adodb.command&quot;)

cn.Provider = &quot;sqloledb&quot;
provStr = &quot;driver={sql server}; Server=server_name; Database=db_name; uid=user; pwd=pwd&quot;
cn.Open provStr

Set cmd.ActiveConnection = cn

response.write &quot;after connect string&quot; + &quot;<br>&quot;
%>

<%

'_________________________________________________________________
'this is a new page really.. but i just put it here.

' CREATE THE APPLICATION OBJECT
If Not IsObject (session(&quot;oApp&quot;)) Then
response.write &quot;before oApp create app&quot; + &quot;<br>&quot;
Set session(&quot;oApp&quot;) = Server.CreateObject(&quot;CrystalRuntime.Application&quot;)
End If

' CREATE THE REPORT OBJECT

Path = Request.ServerVariables(&quot;PATH_TRANSLATED&quot;)
response.write &quot;path=&quot; + path + &quot;<br>&quot;
While (Right(Path, 1) <> &quot;\&quot; And Len(Path) <> 0)
iLen = Len(Path) - 1
Path = Left(Path, iLen)
Wend

'OPEN THE REPORT (but destroy any previous one first)
If IsObject(session(&quot;oRpt&quot;)) then
Set session(&quot;oRpt&quot;) = nothing
End if

On error resume next
response.write path + &quot; : &quot; + reportname + &quot;<br>&quot;
Set session(&quot;oRpt&quot;) = session(&quot;oApp&quot;).OpenReport(path & reportname, 1)
'This line uses the &quot;PATH&quot; and &quot;reportname&quot; variables to reference the Crystal
'Report file, and open it up for processing.

If Err.Number <> 0 Then
Response.Write &quot;Error Occurred creating Report Object: &quot; & Err.Description
Set Session(&quot;oRpt&quot;) = nothing
Set Session(&quot;oApp&quot;) = nothing
Session.Abandon
Response.End
else
response.write &quot;no errors with set orpt.openreport&quot; + &quot;<br>&quot;
End If

response.write &quot;before setting oRpt session variables&quot; + &quot;<br>&quot;
session(&quot;oRpt&quot;).MorePrintEngineErrorMessages = False
session(&quot;oRpt&quot;).EnableParameterPrompting = False
session(&quot;oRpt&quot;).DiscardSavedData
response.write &quot;after setting oRpt session variables&quot; + &quot;<br>&quot;

%>
'_________________________________________________________________


'_________________________________________________________________
'this is a new page really.. but i just put it here.
<%
On Error Resume Next
'(dying some place here in the next couple lines!!)

session(&quot;oRpt&quot;).ReadRecords

If Err.Number <> 0 Then
Response.Write &quot;Error Occurred Reading Records: &quot; & Err.Description (<- this is where my error message is coming from)
Set Session(&quot;oRpt&quot;) = nothing
Set Session(&quot;oApp&quot;) = nothing
Session.Abandon
Response.End
Else
If IsObject(session(&quot;oPageEngine&quot;)) Then
set session(&quot;oPageEngine&quot;) = nothing
End If
set session(&quot;oPageEngine&quot;) = session(&quot;oRpt&quot;).PageEngine
End If
%>

'_________________________________________________________________
'this is a new page really.. but i just put it here.

<HTML>
<HEAD>
<TITLE>Crystal Decisions ActiveX Viewer</TITLE>
</HEAD>
<BODY BGCOLOR=C6C6C6 ONUNLOAD=&quot;CallDestroy();&quot; topmargin=0 leftmargin=0>

<OBJECT ID=&quot;CRViewer&quot;
CLASSID=&quot;CLSID:C4847596-972C-11D0-9567-00A0C9273C2A&quot;
WIDTH=100% HEIGHT=99%
CODEBASE=&quot;/viewer/activeXViewer/activexviewer.cab#Version=8,5,0,217&quot;>
<PARAM NAME=&quot;EnableRefreshButton&quot; VALUE=1>
<PARAM NAME=&quot;EnableGroupTree&quot; VALUE=1>
<PARAM NAME=&quot;DisplayGroupTree&quot; VALUE=1>
<PARAM NAME=&quot;EnablePrintButton&quot; VALUE=1>
<PARAM NAME=&quot;EnableExportButton&quot; VALUE=1>
<PARAM NAME=&quot;EnableDrillDown&quot; VALUE=1>
<PARAM NAME=&quot;EnableSearchControl&quot; VALUE=1>
<PARAM NAME=&quot;EnableAnimationControl&quot; VALUE=1>
<PARAM NAME=&quot;EnableZoomControl&quot; VALUE=1>
</OBJECT>

<SCRIPT LANGUAGE=&quot;VBScript&quot;>
<!--
Sub Window_Onload
'window. alert &quot;in&quot;
On Error Resume Next
Dim webBroker
Set webBroker = CreateObject(&quot;WebReportBroker.WebReportBroker&quot;)
if ScriptEngineMajorVersion < 2 then
window.alert &quot;in if&quot;
window.alert &quot;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.&quot;
CRViewer.ReportName = &quot;rptserver1.asp&quot;
else
window.alert &quot;in else&quot;
Dim webSource
Set webSource = CreateObject(&quot;WebReportSource.WebReportSource&quot;)
webSource.ReportSource = webBroker
webSource.URL = &quot;rptserver1.asp&quot;
webSource.PromptOnRefresh = True
CRViewer.ReportSource = webSource
end if
window.alert &quot;out of if&quot;
CRViewer.ViewReport
window.alert session(&quot;oApp&quot;).value
window.alert &quot;after viewreport&quot;

End Sub
-->
</SCRIPT>

<script language=&quot;javascript&quot;>
function CallDestroy()
{
window.open(&quot;Cleanup.asp&quot;,&quot;Cleanup&quot;,&quot;status=no,toolbar=no,location=no,menu=no,scrollbars=no,width=1,height=1&quot;);
self.focus()
}
</script>

</BODY>
</HTML>
'_________________________________________________________________

I would appreciate any help that anyone could give! Like i said before all this code basically comes from the samples from crystal.. all i changed really was the report name and my database connection stuff.

Thanks for your time!!
~Jeni

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top