473,473 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

CR doesn't work with SQL Server in ASP

Hello,

I get the error Error Occured Reading Records: Server has
not yet been opened. when I am trying to view a report
using the asp pages for crystal reports. It works fine
for access files. Can someone help me on it?

Thanks in advance!

Jane
Jul 19 '05 #1
2 3652
Jane,

Post your code and perhaps someone will be able to help.

John

-----Original Message-----
Hello,

I get the error Error Occured Reading Records: Server has
not yet been opened. when I am trying to view a report
using the asp pages for crystal reports. It works fine
for access files. Can someone help me on it?

Thanks in advance!

Jane
.

Jul 19 '05 #2
Here is the code. I realize there is nowhere I can put the
login information to connect to SQL Server.

<%@ LANGUAGE="VBSCRIPT" %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio
6.0">
<script language="javascript">
function CallDestroy()
{
window.open("Cleanup.asp");
}

function reminder()
{
window.alert("Please close down the Report window
as soon as you are done. Since there are only 5 users can
use it at same time!")
}
</script>
</HEAD>
<BODY ONUNLOAD="CallDestroy();" onLoad="reminder()">

<% Dim sSQL, sWhere
sSQL=Request.Form("sql")

'-- get report name
reportname = "Report1.rpt"

If Not IsObject (session("oApp"))
Then
Set session("oApp") = Server.CreateObject
("CrystalRuntime.Application")
End
If
Call session("oApp").SetMorePrintEngineErrorMessages(0)
Call session("oApp").SetMatchLogonInfo(1)

Path = Request.ServerVariables
("PATH_TRANSLATED")
While (Right(Path, 1) <> "\" And Len(Path) <>
0)
iLen = Len(Path) -
1
Path = Left(Path,
iLen)
Wend
'Response.Write (Path) & "<br>"

If IsObject(session("oRpt")) then
Set session("oRpt") = nothing
End if

On error resume next
'-- get report file path
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

'-- disable the Error reporting
session("oRpt").MorePrintEngineErrorMessages = False
session("oRpt").EnableParameterPrompting = False

session("oRpt").DiscardSavedData

'-- build the new SQL Query String for the report
NewQueryString="Select * From vewODRpt1220"

Response.Write (NewQueryString) & "<br>"
session("oRpt").SQLQueryString = CStr(NewQueryString)

On Error Resume Next
session("oRpt").ReadRecords
If Err.Number <> 0
Then
Response.Write "Error Occurred Reading Records: " &
Err.number & ", " & 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
%>

<OBJECT ID="CRViewer1"
CLASSID="CLSID:C4847596-972C-11D0-9567-
00A0C9273C2A"
WIDTH=100%
HEIGHT=100%

codebase="/viewer/activeXViewer/activexviewer.cab#Version=8
,5,0,217">
<param name="EnableGroupTree" value=1>
<param name="DisplayGroupTree" value=1>
<param name="EnableRefreshButton" value=1>
<param name="EnablePrintButton" value=1>
<param name="EnableExportButton" value=1>
<param name="EnableSearchControl" value=1>
<param name="EnableDrillDown" value=1>
<param name="EnableAnimationControl" value=1>
<param name="EnableZoomControl" value=1>
</OBJECT>

<SCRIPT LANGUAGE="VBScript">
Call Page_Initialize

Sub Page_Initialize
On Error Resume Next
Dim WebBroker1
Set WebBroker1 = CreateObject
("WebReportBroker.WebReportBroker")
Call GetURL(URL)
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."
CRViewer1.ReportName = URL
+ "rptserver.asp"
else
Dim WebSource1
Set WebSource1 = CreateObject
("WebReportSource.WebReportSource")
WebSource1.ReportSource = WebBroker1
WebSource1.URL = URL + "rptserver.asp"
WebSource1.PromptOnRefresh = true
CRViewer1.ReportSource = WebSource1
Response.Write (WebSource1) & "b<br>"
end if
CRViewer1.ViewReport
End Sub

Sub GetURL(ByRef URL)
HREF = Location.Href
URL= ""
nPos = InStr(HREF, "/")
While (nPos > 0)
URL = URL & Left( HREF, nPos )
HREF = Mid(HREF, nPos + 1)
nPos = InStr(HREF, "/")
Wend
End Sub
</SCRIPT>
</BODY>
</HTML>

-----Original Message-----
Jane,

Post your code and perhaps someone will be able to help.

John

-----Original Message-----
Hello,

I get the error Error Occured Reading Records: Server hasnot yet been opened. when I am trying to view a report
using the asp pages for crystal reports. It works fine
for access files. Can someone help me on it?

Thanks in advance!

Jane
.

.

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Julian | last post by:
Hi I have code in my login.asp which sets the online field in user database to true or 1. I am trying to use the same code in global.asa to change back the online field to 0 but it doesn't work....
6
by: A.M-SG | last post by:
Hi, I have an aspx page at the web server that provides PDF documents for smart client applications. Here is the code in aspx page that defines content type: Response.ContentType =...
4
by: Chris Lane | last post by:
Hi, I have an HTML RESET button and Web Control Button that posts back to the server. Problem is the reset button doesn't work after the postback occurs. Any ideas or suggestions as to why this...
10
by: Mr. x | last post by:
Hello, I have some code as follows. It seems that customValidator doesn't work - because i don't get any message. In the body : <asp:table> <asp:TableRow>
4
by: Joe | last post by:
Hello, I have created a login page using dotnet. I am using requiredFieldValidator and noticed that the code works fine in IE but not in Netscape, Opera, Mozilla, Firefox, etc. For example...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
0
by: Buddy Ackerman | last post by:
I have one page where I used field validator controls and it works fine. It is set to do client side validation. I did the same thing on another page and set everything the same way as the first...
12
by: mednyk | last post by:
T-SQL Debugger Doesn't Allow Stepping Through Stored Procedures And there is no other procedure with the same name owned by dbo or any other users. There is no error messages also, it just...
39
by: alex | last post by:
I've converted a latin1 database I have to utf8. The process has been: # mysqldump -u root -p --default-character-set=latin1 -c --insert-ignore --skip-set-charset mydb mydb.sql # iconv -f...
3
by: =?Utf-8?B?Um9nZXIgTWFydGlu?= | last post by:
Note: My apologies for repeating this post from last week, but my nospam alias and profile account were incorrect. I think I have fixed this, so hopefully this post will trigger MS into a response...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.