Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cannot connect ADO data source to reports
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Crystal Reports
Divers
Thread ID:
00695306
Message ID:
00696691
Vues:
13
Okay... guess I'm being unclear.

I do realize that to get the object you do a
ocDBT = oDB.Tables()
but I "thought" you had created the variable as an object before that assignment. I got confused by the VFP7 intellisense code because I have no idea about it... thought you were doing VB, so my apologies.

I'll keep working with it. I had done the code just as you posted and was still getting errors. I was going to write about that then got all confused thinking I was creating objects incorrectly.

Think I'm going to create an ADODB_Craig() function and copy out your stuff exactly and try that. Hopefully a fresh head will help.

One question... in your example you use the oRpt.PrintOut() function. Would it make any difference that I am showing this report in the preview window? Or would it matter that I'm trying to make the refresh work (that's the lighting looking icon on the control)?

Thanks for all the help,

Shawn
>My code is VFP 7. The LOCAL AS is for Intellisense.
>
>Look at my code more closely. You'll see that to get a reference to the DatabaseTables collection, I do:
>
>
>ocDBT = oDB.Tables()
>
>
>
>>Craig,
>>
>>I was about to list my problems I'm having and I realize something.
>>
>>When you created your local variables for database, tables, etc., you created them as objects. So I tried to do the same
>>
ocDBT = CREATEOBJECT("CRAXDRT.DatabaseTables")
>>but that class is not found. So I tried
>>
ocDBT = CREATEOBJECT("CrystalRuntime.DatabaseTables")
>>which again failed. I searched the registry to see if I could determine the correct call but no luck.
>>
>>So what is the tanslation to VFP?
LOCAL oCR AS CRAXDRT.Application
is a VB syntax isn't it?
>>
>>Thanks,
>>
>>Shawn
>>PS - When's the book due? I'll definately want a copy of that!
>>>This code will work:
>>>
>>>
>>>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 references 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()
>>>
>>>
>>>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform