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("10/7/02"
tsale_date = Cdate("10/8/02"
reportname="../Reports/Region.rpt"
Set oConn = Server.CreateObject( "ADODB.Connection" )
Set objCmd = Server.CreateObject( "ADODB.Command" )
Set session("oRs" = Server.CreateObject( "ADODB.Recordset" )
sConn = "uid=Foodsrvc;pwd=gA15L6;dsn=StockStatus"
oConn.Open sConn
objCmd.ActiveConnection = oConn
objCmd.CommandTimeout = 180
with objCmd
.commandText = "ProcTrackingOverview "
.CommandType = &H0004
.parameters(1) = fsale_date
.parameters(2) = tsale_date
End With
Set session("oRs" = objCmd.Execute()
Set objCmd = nothing
if not session("oRs".eof then
Set session("oApp" = Server.CreateObject("Crystal.CRPE.Application"
Path = Request.ServerVariables("PATH_TRANSLATED"
'response.write path & "<br>"
While Right(Path, 1) <> "\" And Len(Path) <> 0
iLen = Len(Path) - 1
Path = Left(Path, iLen)
Wend
'response.write path
If IsObject(session("oRpt") then
Set session("oRpt" = nothing
End if
Set session("oRpt" = session("oApp".OpenReport(path&reportname,1)
session("oRpt".DiscardSavedData
set Database = session("oRpt".Database
set Tables = Database.Tables
set Table1 = Tables.Item(1)
Table1.SetPrivateData 3,session("oRs"
session("oRpt".ReadRecords
session("oRpt".DiscardSavedData
'On Error Resume Next
If Err.Number <> 0 Then
Response.Write "An Error has occured on the server in attempting to access the data source"
Else
If IsObject(session("oPageEngine") Then
set session("oPageEngine" = nothing
End If
set session("oPageEngine" = session("oRpt".PageEngine
End If
%>
<!-- #include file="SmartViewerActiveX1.asp" -->
<%
else
response.redirect "no_rec_found.asp"
end if
set oConn = nothing
set session("oapp"=nothing
set session("ors"=nothing
%>
I have been working on this for a couple of days, so any help would be appreciated
<%
fsale_date = Cdate("10/7/02"
tsale_date = Cdate("10/8/02"
reportname="../Reports/Region.rpt"
Set oConn = Server.CreateObject( "ADODB.Connection" )
Set objCmd = Server.CreateObject( "ADODB.Command" )
Set session("oRs" = Server.CreateObject( "ADODB.Recordset" )
sConn = "uid=Foodsrvc;pwd=gA15L6;dsn=StockStatus"
oConn.Open sConn
objCmd.ActiveConnection = oConn
objCmd.CommandTimeout = 180
with objCmd
.commandText = "ProcTrackingOverview "
.CommandType = &H0004
.parameters(1) = fsale_date
.parameters(2) = tsale_date
End With
Set session("oRs" = objCmd.Execute()
Set objCmd = nothing
if not session("oRs".eof then
Set session("oApp" = Server.CreateObject("Crystal.CRPE.Application"
Path = Request.ServerVariables("PATH_TRANSLATED"
'response.write path & "<br>"
While Right(Path, 1) <> "\" And Len(Path) <> 0
iLen = Len(Path) - 1
Path = Left(Path, iLen)
Wend
'response.write path
If IsObject(session("oRpt") then
Set session("oRpt" = nothing
End if
Set session("oRpt" = session("oApp".OpenReport(path&reportname,1)
session("oRpt".DiscardSavedData
set Database = session("oRpt".Database
set Tables = Database.Tables
set Table1 = Tables.Item(1)
Table1.SetPrivateData 3,session("oRs"
session("oRpt".ReadRecords
session("oRpt".DiscardSavedData
'On Error Resume Next
If Err.Number <> 0 Then
Response.Write "An Error has occured on the server in attempting to access the data source"
Else
If IsObject(session("oPageEngine") Then
set session("oPageEngine" = nothing
End If
set session("oPageEngine" = session("oRpt".PageEngine
End If
%>
<!-- #include file="SmartViewerActiveX1.asp" -->
<%
else
response.redirect "no_rec_found.asp"
end if
set oConn = nothing
set session("oapp"=nothing
set session("ors"=nothing
%>