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!

Urgent! CR10 and ADO Recordset not working!!

Status
Not open for further replies.

csirman

Programmer
Oct 8, 2001
15
0
0
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top