Passing more than one record set to a report with ADO and ASP 
Author Message
 Passing more than one record set to a report with ADO and ASP


I've been trying to send more than one record set to a Crystal Report
using ADO and ASP.  (I was successful in sending one record set!!).
No data is displayed in the reports for the second and subsequent
record sets.

Does anybody have any ideas?

Below is the code I have written.

ReportName = "Statement1.rpt"

' Now perform the necessary steps to initialise the data for
' opening the report


Dim oRptOptions
Dim CrystalDatabase
Dim CrystalDatabaseTables
Dim CrystalDatabaseTable

'Done here to cope with the case where user pushes refresh button!
set session("adoConn") = nothing
set session("adoRS1") = nothing
set Session("adoRS2") = nothing
set Session("adoRS3") = nothing

If Not IsObject ( Session ("oApp")) Then
     Set Session ("oApp") = Server.CreateObject("Crystal.CRPE.Application")
End If
If Not IsObject ( Session ("oEMF")) Then
set session("oEMF") = Server.CreateObject("cremfgen.cremfgen.1")
End If

set session("adoConn") = Server.CreateObject("ADODB.Connection")

set session("adoRS1") = Server.CreateObject("ADODB.Recordset")
set session("adoRS2") = Server.CreateObject("ADODB.Recordset")
set session("adoRS3") = Server.CreateObject("ADODB.Recordset")

Session("DSN") = Session("MyDB_ConnectionString")
'Now connect to the database and get the recordset objects
Session("adoConn").Open ( Session("DSN") )

Session("adoRS1").CursorType = 3
Session("adoRS1").LockType = 3

Session("adoRS2").CursorType = 3
Session("adoRS2").LockType = 3

Session("adoRS3").CursorType = 3
Session("adoRS3").LockType = 3

SQLStr = "sp_getStoredProc1"
Session("adoRS1").Open SQLStr, Session("adoConn")

'Now get the history record set for that member
ParameterVal = "test"

SQLStr = "sp_getStoredProc2 " & chr(39) & ParameterVal & chr(39)
Session("adoRS2").Open SQLStr, Session("adoConn")

'Now get the member contact information record set
ParameterVal = "test1"

SQLStr = "sp_getStoredProc3" & chr(39) & ParameterVal & chr(39)
Session("adoRS3").Open SQLStr, Session("adoConn")

Path = Request.ServerVariables("PATH_TRANSLATED")
While (Right(Path, 1) <> "\" And Len(Path) <> 0)
iLen = Len(Path) - 1
Path = Left(Path, iLen)

Set session("oRpt") = session("oApp").OpenReport(Path & "reports\" &
ReportName, 1)

' Turn off sepecific report error messages
Set oRptOptions = Session("oRpt").Options
oRptOptions.MorePrintEngineErrorMessages = 0

'Session("oRpt").ParameterPromptingEnabled = false

Set CrystalDatabase = Session("oRpt").Database
Set CrystalDatabaseTables = CrystalDatabase.Tables

Set CrystalDatabaseTable = CrystalDatabaseTables.Item(1)
CrystalDatabaseTable.SetPrivateData 3, Session("adoRS1")

Set CrystalDatabaseTable = CrystalDatabaseTables.Item(2)
CrystalDatabaseTable.SetPrivateData 3, Session("adoRS2")

Set CrystalDatabaseTable = CrystalDatabaseTables.Item(3)
CrystalDatabaseTable.SetPrivateData 3, Session("adoRS3")


' The PageEngine object can derive all (drill down)views of the report
Set Session("oPageEngine") = Session("oRpt").PageEngine

' This file contains the HTML code for the Smart Viewer ActiveX.

<p align="left">
CLASSID = "CLSID:C4847596-972C-11D0-9567-00A0C9273C2A"
<PARAM NAME="Report Name" VALUE="rptserver.asp">
<PARAM NAME="Show Group Tree" VALUE= 1>
<PARAM NAME="Show Toolbar" VALUE= 1>


Mon, 23 Apr 2001 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Passing ADO Connection String to Crystal Report through ASP

2. ASP : Passing values from One ASP to the Next

3. Procedure with 2 record sets one select, one update

4. changes to all records in one rec set based on position in another rec set

5. ASP - Saving html table records or ADO records to Excel or Work

6. Passing One Report Value To Another Report

7. ADO, Record Set Positioning - SQL - Browse Records

8. Need to display multiple lines mini report within one record in a report

9. How do I move a DB record from one table to another in ASP

10. How to pass one record from a recordset as an argument

11. passing records from asp to COM+

12. Passing records from a VB App DB to an ASP DB trough Internet with Dial-Up


Powered by phpBB® Forum Software