Can someone please tell me what is wrong with the following? Everything works great, except, the report does not read the recordset passed. It errors out if I use Discardsaveddata. I have verified that there are valid records in the recordset. I have tried to set the report up as ADO and RDO.
Windows 2003, CR10 Advanced Developer Edition, MDAC2.8, SQLServer 2000
========================================================
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "Provider=SQLOLEDB;User Id=xxxxx;Password=xxxxxx;Initial Catalog=TestDB"
Set oRs = oConn.Execute(strSQL)
If Not IsObject (session("oApp")) Then
Set session("oApp") = Server.CreateObject("CrystalRuntime.Application")
End If
Path = Request.ServerVariables("PATH_TRANSLATED")
While (Right(Path, 1) <> "\" And Len(Path) <> 0)
iLen = Len(Path) - 1
Path = Left(Path, iLen)
Wend
If IsObject(session("oRpt")) then
Set session("oRpt") = nothing
End if
Set session("oRpt") = session("oApp").OpenReport(path & reportname, 1)
session("oRpt").MorePrintEngineErrorMessages = False
session("oRpt").EnableParameterPrompting = False
session("oRpt").DiscardSavedData()
Set oRptTable = session("oRpt").Database.Tables.Item(1)
oRptTable.SetDataSource oRs, 3
session("oRpt").ReadRecords
If IsObject(session("oPageEngine")) Then
set session("oPageEngine") = nothing
End If
set session("oPageEngine") = session("oRpt").PageEngine
Windows 2003, CR10 Advanced Developer Edition, MDAC2.8, SQLServer 2000
========================================================
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open "Provider=SQLOLEDB;User Id=xxxxx;Password=xxxxxx;Initial Catalog=TestDB"
Set oRs = oConn.Execute(strSQL)
If Not IsObject (session("oApp")) Then
Set session("oApp") = Server.CreateObject("CrystalRuntime.Application")
End If
Path = Request.ServerVariables("PATH_TRANSLATED")
While (Right(Path, 1) <> "\" And Len(Path) <> 0)
iLen = Len(Path) - 1
Path = Left(Path, iLen)
Wend
If IsObject(session("oRpt")) then
Set session("oRpt") = nothing
End if
Set session("oRpt") = session("oApp").OpenReport(path & reportname, 1)
session("oRpt").MorePrintEngineErrorMessages = False
session("oRpt").EnableParameterPrompting = False
session("oRpt").DiscardSavedData()
Set oRptTable = session("oRpt").Database.Tables.Item(1)
oRptTable.SetDataSource oRs, 3
session("oRpt").ReadRecords
If IsObject(session("oPageEngine")) Then
set session("oPageEngine") = nothing
End If
set session("oPageEngine") = session("oRpt").PageEngine