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:
00697798
Vues:
13
Craig,

Think I've got a handle on this now. Talked with crystal and it appears the problem is because of design. It appears that since I designed the report with ODBC that's what it will look for no matter what. The tech I spoke with had me use a function called CONVERT DATABASE DRIVER from the DATABASE menu option in Crystal. I changed the DLL file it was using from ODBC to ADO,RDO,DAO and saved the report. It appears to now print the report.

I'll let you know more when I have it, but didn't want you waste time on my last post.

Shawn
>Craig,
>I created a function with your code in it to test. Still however, when I run the printout() function it generates an error of:
> SEGATE CRYSTAL REPORTS: Database Error
> ODBC Error: [Microsoft][ODBC Driver Manager] Connection not open.
>
>The only changes I've made to your code is with the connection string, pointing it to an SQL server and modifying the UID and PWD values.
>
>The only thought I have right now is that maybe it has something to do with the design; that when I designed it I used a DSN that is now destroyed? I thought the setdatasource() was telling it to ignore the original connection info and use ADO but maybe I'm mistaken?
>
>Any directional thoughts you have are greatly appreciated. I'll include the code I used just to make sure I didn't screw it up.
>
>Thanks for your help Craig,
>Shawn
>
>
>LOCAL oCR
>LOCAL oRpt
>LOCAL oDB
>LOCAL ocDBT
>LOCAL oDBT
>LOCAL oConn
>LOCAL oRS
>
>* Handle the ADO stuff
>oConn = CREATEOBJECT("ADODB.Connection")
>oConn.ConnectionString = "Provider=MSDASQL.1;driver={SQL Server};SERVER=Server;DATABASE=DRI_DRI;UID=user;PWD=pass"
>oConn.Open()
>oRS = CREATEOBJECT("ADODB.RecordSet")
>oRS.Open("Select * FROM Borrower", oConn)
>*Test that there's data - there is
>WAIT "Field = " + oRS.Fields['LOANNO'].Value WINDOW
>oCR = CREATEOBJECT("CrystalRuntime.Application")
>
>oRpt = oCR.OpenReport("i:\driwin_css\driwin_cs\reports\crystal\borrower.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()
>
>
>
>
>
>>Under the hood, the viewer control uses the RDC. So, you'll do everything that I posted, then instead of doing a printout, you'll hook up the viewer control. Look at the Crystal Reports article on my web site as it has code for using the viewer control too.
>>
>>>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform