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

VFP SYNTAX TO SET THE SOURCE FILE FOR CRYSTAL REPORTS 1

Status
Not open for further replies.

LeonelSanchezJr

Programmer
Jan 26, 2001
522
US
IN THE FOLLOWING VFP6.0 CODE, I AM RUNNING A STORED PROCEDURE AND I AM GETTING ONE RECORD (RECORDSET).

THEN, I AM INVOKING CRYSTAL REPORTS, BUT MY PROBLEM IS THAT I HAVE TO GET THE VFP SYNTAX TO SET THE CRYSTAL REPORT DATASOURCE TO THE RECORDSET.

HERE IS MY CODE:

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 preview Crystal report
oCRApp = createobject("crystal.crpe.application")
oRep = oCRApp.OpenReport("d:\leo\Mawb_laser.rpt")

oRep.Preview
wait


THANK YOU FOR YOUR TIME AND EFFORTS.
 
I think it's actually Crystal Reports syntax that you're short of, not VFP syntax, because the methods available to your oRep object are CR methods not VFP methods - so you're hoping for CR to expose a method that can accept your ADO recordset as parameter.
I don't have CR - but I noticed when I logged in today that this week's Tipmaster is a Crystal Reports man ;-)
 
I finally got the answer to the original questin I started off with. Here is the code to accomplish this. Thanks for everyone's help.

*** 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")

*** 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


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top