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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Web Reports Please HELP

Status
Not open for further replies.

durug

Technical User
Mar 22, 2002
335
0
0
CA
Hi everybody!

I copied this code from which. It's supposed to allow me to run the CR8 object in IE passing two string parameters.
The report is running fine in Crystal Report but on ASP I'm getting this error "An exected error occured" on this line
session("oRpt").ReadRecords

Here is my code:
<%
reportname = &quot;PO.rpt&quot;

If Not IsObject (session(&quot;oApp&quot;)) Then
Set session(&quot;oApp&quot;) = Server.CreateObject(&quot;CrystalRuntime.Application&quot;)
End If

Path = &quot;C:\Inetpub\
If IsObject(session(&quot;oRpt&quot;)) then
Set session(&quot;oRpt&quot;) = nothing
End if

Set session(&quot;oRpt&quot;) = session(&quot;oApp&quot;).OpenReport(path & reportname, 1)

session(&quot;oRpt&quot;).MorePrintEngineErrorMessages = False
session(&quot;oRpt&quot;).EnableParameterPrompting = False
session(&quot;oRpt&quot;).DiscardSavedData

set session(&quot;ParamCollection&quot;) = Session(&quot;oRpt&quot;).Parameterfields

set Param1 = session(&quot;ParamCollection&quot;).Item(1)
Param1.EnableMultipleValues = 1
ParamValue = &quot;100000&quot;
Call Param1.AddCurrentValue (CStr(ParamValue))
set Param2 = session(&quot;ParamCollection&quot;).Item(2)
Param2.EnableMultipleValues = 1
ParamValue1 = &quot;CHI112&quot;
Call Param2.AddCurrentValue (CStr(ParamValue1))

On Error Resume Next
session(&quot;oRpt&quot;).ReadRecords 'line with error
If Err.Number <> 0 Then
Response.write err.description
Response.Write &quot;An Error has occured on the server in attempting to access the data source&quot;
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
%>
<!-- #include file=&quot;SmartViewerActiveX.asp&quot; -->


Can anybody help me to solve this problem. Its' getting nowhere!

Thank you a lot!
Durug
 
If your database is SQL server then you need to give access to your script to access the database, this can be done by:
Set DatabaseTablesCollection = Session(&quot;oRpt&quot;).Database.Tables
For Each Table in DatabaseTablesCollection
Table.SetLogonInfo &quot;dsnName&quot;, &quot;databaseName&quot;, &quot;username&quot;, &quot;password&quot;
Next

Hope this solves your problem.
 

hi,

Try verifying database if u have made any change if seema's solution doesn't work
:)
 
Now the error is on the same line but with this description
&quot;An exception occured&quot;

Thanks,
Durug
 
When I created the report I used sa to login to the DB.
Betaanish, what do you mean by verifying database?

Thanks,
Durug
 
Please, to prepare the report for the web what are the neccessary steps?
I've done this:
bring the whole report, adding 2 parameter, enter the expert formula for the 2 parameter. Do I have t oclick save data with report?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top