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

Report hanging on session("oRpt").DiscardSavedData

Status
Not open for further replies.

obuspider

Programmer
Oct 31, 2002
78
US
I'm working on an application that displays reports using Crystal Reports through ASP. If anyone is familiar with this could you take a look at this code and see if you have any ideas why it is hanging. It seems to hang when it gets to session("oRpt").DiscardSavedData

I have been working on this for a couple of days, so any help would be appreciated

<%
fsale_date = Cdate(&quot;10/7/02&quot;)
tsale_date = Cdate(&quot;10/8/02&quot;)
reportname=&quot;../Reports/Region.rpt&quot;
Set oConn = Server.CreateObject( &quot;ADODB.Connection&quot; )
Set objCmd = Server.CreateObject( &quot;ADODB.Command&quot; )
Set session(&quot;oRs&quot;) = Server.CreateObject( &quot;ADODB.Recordset&quot; )

sConn = &quot;uid=Foodsrvc;pwd=gA15L6;dsn=StockStatus&quot;
oConn.Open sConn
objCmd.ActiveConnection = oConn
objCmd.CommandTimeout = 180


with objCmd
.commandText = &quot;ProcTrackingOverview &quot;
.CommandType = &H0004
.parameters(1) = fsale_date
.parameters(2) = tsale_date

End With

Set session(&quot;oRs&quot;) = objCmd.Execute()
Set objCmd = nothing

if not session(&quot;oRs&quot;).eof then

Set session(&quot;oApp&quot;) = Server.CreateObject(&quot;Crystal.CRPE.Application&quot;)

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

Wend
'response.write path
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;).DiscardSavedData
set Database = session(&quot;oRpt&quot;).Database
set Tables = Database.Tables
set Table1 = Tables.Item(1)
Table1.SetPrivateData 3,session(&quot;oRs&quot;)
session(&quot;oRpt&quot;).ReadRecords
session(&quot;oRpt&quot;).DiscardSavedData
'On Error Resume Next
If Err.Number <> 0 Then
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;SmartViewerActiveX1.asp&quot; -->
<%
else
response.redirect &quot;no_rec_found.asp&quot;
end if

set oConn = nothing
set session(&quot;oapp&quot;)=nothing
set session(&quot;ors&quot;)=nothing

%>
 
you need to remove the line which is marked <---
session(&quot;oRpt&quot;).DiscardSavedData
set Database = session(&quot;oRpt&quot;).Database
set Tables = Database.Tables
set Table1 = Tables.Item(1)
Table1.SetPrivateData 3,session(&quot;oRs&quot;)
session(&quot;oRpt&quot;).ReadRecords
session(&quot;oRpt&quot;).DiscardSavedData <-----------

i hope this solves your problem.
cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top