Results 1 to 10 of 13

Thread: Q: ADO, RDO, OLE DB, what to use?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #13
    Join Date
    Mar 2009
    Location
    Geelong, Australia
    Posts
    34

    Default Re: Q: ADO, RDO, OLE DB, what to use?

    Hi Guys,
    I am trying to re direct the DataFlex sourced crystal reports to use a SQL connection using DataFlex 18.2

    Starting with Hans van de Laar Code from and calling it from Procedure OnInitializeReport
    I get the location and login box for the files.

    Click image for larger version. 

Name:	CrystalLoginDetails.JPG 
Views:	129 
Size:	31.7 KB 
ID:	12864

    What am I missing our here?
    Where should I have connections.ini or ConnectionIds.Ini located?

    Code:
       Set pbAutoLocateDFFiles to False
    
    
       //Hans van de Laar Code
       Procedure InitializeODBConnection Handle hoReport
          Boolean bAttached 
          Handle hoConnectionProperties 
          Variant vConnectionProperties 
          String sTable 
          Integer iTableItem iTableCount
          Handle[] hoTables
          Handle hoDatabaseTable
          Boolean bOk
              
          Get TableObjects of hoReport to hoTables
          Move (SizeOfArray(hoTables)) to iTableCount
          For iTableItem from 0 to (iTableCount-1)
             Get ComName of hoTables[iTableItem] to sTable
             Get GetTableObjectByName of hoReport sTable to hoDatabaseTable
             Move (hoDatabaseTable) to bOk
             If bOk Begin
                Get create U_cCrystalConnectionProperties to hoConnectionProperties
                Get ComConnectionProperties of hoDatabaseTable to vConnectionProperties
                Set pvcomObject of hoConnectionProperties to vConnectionProperties
                Get IsComObjectCreated of hoConnectionProperties to bAttached
                    
                If (not(bAttached)) Begin
                   Error DFERR_CRYSTAL_REPORT "ConnectionProperties"
                End
                Else Begin
                   Send ComDeleteAll of hoConnectionProperties
                   Send ComAdd of hoConnectionProperties "Provider" "SQLOLEDB"
                   Send ComAdd of hoConnectionProperties "Data Source" "THERM04\MEDIFLEX" // (psServerName(Self))  //  <-- You have to determine yourself
                   Send ComAdd of hoConnectionProperties "Initial Catalogue" "MediFlex" //(psDataBase(Self))
                   Send ComAdd of hoConnectionProperties "User ID" "" //(psUsername(Self))
                   Send ComAdd of hoConnectionProperties "Password" "" //(psPassWord(Self))            
                   Send ComAdd of hoConnectionProperties "Integrated Security" 1 //0            
                 End
                Send destroy of hoConnectionProperties
             End
          Loop
       End_Procedure
       
       Procedure DoInitializeODBConnection Handle hoReport // <---- Call this in OnInitializeReport
          Integer iReportCount iReportItem
          Handle[] SubReportArray
    
    
          //
          Send InitializeODBConnection hoReport
          //
          Get SubReportObjects of hoReport to SubReportArray
          Move (SizeOfArray(SubReportArray)) to iReportCount
          For iReportItem from 0 to (iReportCount-1)
             If (SubReportArray[iReportItem]) Begin
                Send InitializeODBConnection (SubReportArray[iReportItem])
             End
          Loop
       End_Procedure
    
    
       Procedure OnInitializeReport 
          Forward Send OnInitializeReport  hoReport
    
    
          Send Destroy_Object of hoSQLConnection
          Send DoInitializeODBConnection hoReport
       End_Procedure // OnInitializeReport
    Last edited by DavidG; 17-Jun-2019 at 05:39 PM. Reason: VDF Version

Similar Threads

  1. Connect to SQL via OLE DB (ADO)
    By Thomas Murphy in forum Crystal Reports
    Replies: 6
    Last Post: 10-Oct-2011, 03:05 AM
  2. pdf ado stream
    By John Vermeer in forum Web & Mobile Applications
    Replies: 4
    Last Post: 28-Sep-2010, 07:54 AM
  3. ADO Close method
    By Tim Copenhaver in forum Windows Applications
    Replies: 4
    Last Post: 23-Apr-2008, 12:34 AM
  4. OLE Automation
    By HenryEgal in forum Windows Applications
    Replies: 2
    Last Post: 27-Feb-2006, 11:01 PM
  5. Multiples LOGINS => VDF drivers (ex. ODBC) and an external ADO (OLEDB)
    By Cesar Margarida in forum Windows Applications
    Replies: 4
    Last Post: 6-Jul-2005, 04:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •