Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to merge ADODB recordsets - Crystal
Message
From
02/05/2002 12:57:18
 
 
To
02/05/2002 12:00:09
General information
Forum:
Visual Basic
Category:
Database DAO/RDO/ODBC/ADO
Miscellaneous
Thread ID:
00651950
Message ID:
00651981
Views:
22
Here's some FoxPro code that may help you.
LOCAL oCR AS CRAXDRT.Application
LOCAL oRpt AS CRAXDRT.Report
LOCAL oDB AS CRAXDRT.Database
LOCAL ocDBT AS CRAXDRT.DatabaseTables
LOCAL oDBT AS CRAXDRT.DatabaseTable

LOCAL oConn AS ADODB.Connection
LOCAL oRS AS ADODB.Recordset

* Handle the ADO stuff
oConn = CREATEOBJECT("ADODB.Connection")
oConn.ConnectionString = "Provider=VFPOLEDB.1;Data Source=C:\eFox\Data\tastrade.dbc;Password=''"
oConn.Open()
oRS = CREATEOBJECT("ADODB.RecordSet")
oRS.Open("Select * FROM Customer", oConn)

oCR = CREATEOBJECT("CrystalRuntime.Application")

oRpt = oCR.OpenReport("C:\EFox\ADO1.RPT")

* Create the Database object
oDB = oRpt.Database()

* Get a reference to the DatabaseTables collection
ocDBT = oDB.Tables()

* Get a reference to the DatabaseTable object for table 1
oDBT = ocDBT.Item(1)

* Pass the Record Set to Crystal Reports
oDBT.SetDataSource(oRS)

IF oRPt.HasSavedData
	oRPT.DiscardSavedData()
ENDIF

oRpt.PrintOut()
>I have a Crystal report that is currently used with access. It takes multiple queries to get to the final query that populates the report.
>
>I am trying to move the report to use in a VB app instead of access. I have changed the report datasource to a ttx file and now I need to figure out how to merge multipe recordsets into 1. I considered continuing to use the dao queries but it takes 2 - 3 minutes to run the report from VB and we are eventually going to be switching to SQL. I am attempting to get as much as done now so that in 3 months when we switch over there will not be a delay in running reports.
>
>Here is a sample of my access code:
>
> sql = "SELECT FOB_Customer_Header.*, Customer.Name, Address.Line1, Address.Line2, Address.City, Address.State, " & _
> "Address.Zip, Address.Phone, Address.Fax, Address.Country " & _
> "FROM (Customer INNER JOIN FOB_Customer_Header ON Customer.Customer = FOB_Customer_Header.Customer) " & _
> "INNER JOIN Address ON Customer.Customer = Address.Customer " & _
> "WHERE (Address.Ship_To_ID = 'Main') " & _
> "AND FOB_Customer_Header.qhIndex = " & v_Customer & " "
>
> Set QueryDef = CurrentDb.CreateQueryDef("d_Customer_Quote_1", sql)
>
> sql = "SELECT d_Customer_Quote_1.*, Contact.Contact_Name as Buyer_Name " & _
> "FROM d_Customer_Quote_1 LEFT JOIN Contact ON d_Customer_Quote_1.Buyer = Contact.Contact;"
>
> Set QueryDef = CurrentDb.CreateQueryDef("d_Customer_Quote_2", sql)
>
> sql = "SELECT d_Customer_Quote_2.*, Contact.Contact_Name as Buyer_Name2 " & _
> "FROM d_Customer_Quote_2 LEFT JOIN Contact ON d_Customer_Quote_2.Buyer2 = Contact.Contact;"
>
> Set QueryDef = CurrentDb.CreateQueryDef("d_Customer_Quote_3", sql)
>
>*******************
>
>d_Customer_Quote_3 would be what I am trying to send to Crystal as 1 ado recordset.
>
>I would appreciate any help.
>
>Thanks
>Nichole
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Reply
Map
View

Click here to load this message in the networking platform