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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I pass a Recordset from Visual Foxpro to Crystal Reports using a Stored Procedure for the SQL query?

Coding and Syntax

How can I pass a Recordset from Visual Foxpro to Crystal Reports using a Stored Procedure for the SQL query?

by  LeonelSanchezJr  Posted    (Edited  )
*** code to create object and query sql
oAdo = CreateObject('AdoDb.Connection')
oAdor = CreateObject('Ador.Recordset')
oAdo.ConnectionString = [Provider=SQLoledb;data source= WIN2KMOBILE001;User ID =talondeveloper;Password=;Connect Timeout=3]
oADO.Open
oAdo.DefaultDatabase = 'Talon_Dot_Net'
oAdor = oAdo.Execute("exec ConsolidatedAirExport_SelectWaybillHeader 'TESTMAWB001'")

*** code to open Crystal report
oCRApp = createobject("crystal.crpe.application")
*oRep = oCRApp.OpenReport("d:\leo\Mawb_laser.rpt")
oRep = oCRApp.OpenReport("D:\My Documents\Crystal Reports\Mawb_laser.rpt")
*** temp code to discard saved data (this must be included in order to discard any saved data with report
oRep.discardsaveddata
***

*** pass the recordset to the report
oDatabase = oRep.Database
oDatabaseTables = oDatabase.Tables
oDatabaseTable = oDatabaseTables.Item(1)
oDatabaseTable.SetPrivateData (3, oADOr)

*** code to preview the Crystal report
oRep.Preview
*wait


Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top