ADO RDD xHarbour

Re: ADO RDD xHarbour

Postby James Bott » Thu Jul 02, 2015 9:36 pm

Vilian,

It appears to be saying that it is not finding the database. Perhaps the path is not specified or is incorrect.

You should also check your normal connection syntax with that being used in the ADORDD.PRG's ADOOOPENCONNECT() function.

I don't have MySQL installed here so I can't test it. Plus I am running xHarbour not Harbour.

I do suggest using the ACCESS Northwind.mdb to get started. After you get that opened successfully, then you can try other databases. MySQL is supposed to be syntax compatible so it should be easy once you get Northwind.mdb working.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: ADO RDD xHarbour

Postby James Bott » Fri Jul 03, 2015 5:56 pm

Vilian,

See postings 4, and 5 on page 27 of this message thread on solving issues with Harbour.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: ADO RDD xHarbour

Postby vilian » Fri Jul 03, 2015 6:07 pm

James,

Thanks, but we decided make this migration using Tdolphin. It is more easy than I did think ;)
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 977
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: ADO RDD xHarbour

Postby James Bott » Tue Jul 07, 2015 11:55 pm

Antonio F.,

There is a typo in this SET command from the ado.ch file:

#command SET ADO TEMPORAY NAMES INDEX LIST TO <array> => ListTmpNames( <array>) /* defining temporary index array list of names*/

"TEMPORAY" should be "TEMPORARY". I know this will break backward compatibility, but without it all new code will be causing errors because everyone will think they should be typing "temporary."

Strangely, I note that the spell checker for IE does not flag "TEMPORAY" as misspelled if it is in all caps--only if it is lower case.

Keep up the great work you are doing.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: ADO RDD xHarbour

Postby James Bott » Fri Jul 10, 2015 1:20 am

Antonio F,

I am attempting to import records from a DBF to an Access table. This crashes:

Code: Select all  Expand view
/*
Purpose: Large file ADORDD test
Author : James Bott
Date   : 7/9/2015 4:52:20 PM

*/


#include "fivewin.ch"
#include "adordd.ch"

REQUEST ADORDD, ADOVERSION

FUNCTION Main()

   RddRegister("ADORDD",1)
   RddSetDefault("ADORDD")
   
   SET ADO FORCE LOCK OFF  

   SET ADO DEFAULT DATABASE TO "northwind.mdb" ;
       SERVER TO "Microsoft.Jet.OLEDB.4.0"       ;
       ENGINE TO "ACCESS"
       
   SELECT 0
   USE PTIME alias "ptimeADO" via "ADORDD"
   
   append from ptime via "DBFCDX"
   
   BROWSE()

Return nil
 

And this is the error:

Code: Select all  Expand view
Application
===========
   Path and name: C:\Users\James\Documents\Projects\ADORDD\Test5.exe (32 bits)
   Size: 3,003,904 bytes
   Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20130326)
   FiveWin  Version: FWHX 15.05
   Windows version: 6.2, Build 9200

   Time from start: 0 hours 0 mins 0 secs
   Error occurred at: 07/09/15, 18:17:08
   Error description: Error DBCMD/1005  Argument error: __DBAPP

Stack Calls
===========
   Called from:  => __DBAPP( 0 )
   Called from: Test5.prg => MAIN( 27 )


The crash is happening at this line:

append from ptime via "DBFCDX"

Without that line it runs fine.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: ADO RDD xHarbour

Postby James Bott » Fri Jul 10, 2015 9:08 pm

Antonio F,

I have been unable to do any type of APPEND. Either there are bugs in the ADORDD or I am doing something wrong.

APPEND FROM... errors out as shown in my previous message. And, APPEND BLANK errors out in the code below. This means that I cannot get any data into the table using ADORDD. I suspect I am doing something wrong but I don't have a clue what it might be.

Anyone else know? Anyone able to do an APPEND? If so, please provide example code.

Code: Select all  Expand view
/*
Purpose: File append test
Author : James Bott
Date   : 7/9/2015 4:52:20 PM

*/


#include "fivewin.ch"
#include "adordd.ch"

REQUEST ADORDD, ADOVERSION

FUNCTION Main()

   //createTemp()

   RddRegister("ADORDD",1)
   RddSetDefault("ADORDD")
 
   SET ADO FORCE LOCK OFF  

   SET ADO DEFAULT DATABASE TO "northwind.mdb" ;
       SERVER TO "Microsoft.Jet.OLEDB.4.0"       ;
       ENGINE TO "ACCESS"
       
    // CONTROL LOCKING IN ADORDD FOR BOTH TABLE AND RECORD DONT PUT FINAL "\"
    // Including the next line causes an error - JBott
  // SET ADO LOCK CONTROL SHAREPATH TO  "C:\users\james\documents\projects\adordd" RDD TO "DBFCDX"

   // Note: File is empty
   SELECT 0
   USE PTIME alias "ptimeADO" //via "ADORDD"
   
   msgInfo( used(),"File open" )  // returns .t.
   
   msgInfo(tcharge2,"TCHARGE2")   // returns 0.00
   
   append blank                     // crashes
   msginfo("Appended blank record")
   tcharge2:=111.11
   
   
  // append from temp via "DBFNTX" // crashes here
   
   BROWSE()

Return nil
 

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: ADO RDD xHarbour

Postby James Bott » Tue Jul 14, 2015 2:02 pm

I note that Antonio Ferreira seems to have disappeared. He hasn't posted anything on this forum since June 30.

Is the ADORDD project now dead?

Does anyone know what happened to him? I hope he has just been too busy.

I am very anxious to get some data into a SQL database, but so far have been unable to do so using the ADORDD. And I have had no response to any of my questions about this here.

Does anyone have sample (working) code to import a DBF? Preferably into an ACCESS database.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: ADO RDD xHarbour

Postby pieter » Thu Jul 16, 2015 11:36 am

Hi James,

Antonio F wrote me that he is on holiday in July.

Do you mean to import a dbf file and export it to a sql database in general? (see code below) or with adordd?, another tool is: http://dbfviewer2000.com

Code: Select all  Expand view
#include "FiveWin.ch"
#include "adodef.ch"
 
REQUEST DBFCDX
 
static oCn
 
//----------------------------------------------------------------------------//
 
function MyTest()
 
   local oRs
   CreateDatabaseIfNotYetExist()
   ConnectWithDatabase()
   FW_AdoImportFromDBF( oCn, "C:\Pieter\Dev\import\customer.dbf")
   
   oRs = TRecSet():New():Open( "customer", oCn )
   
   
 
   if oRs:IsOpen()
 
      XBROWSER oRs // SETUP oBrw:lIncrFilter := .T.
               // SETUP oBrw:bEdit := { | oRec | MyEdit( oRec ) }
                 // SETUP oBrw:lIncrSearch := .T.
                   // SETUP oBrw:lWildSeek := .T.                  
 
      oRs:Close()
   else
      MsgAlert( "The recordset could not be opened" )
      MsgInfo( "Check that you have REQUEST DBFCDX" )      
   endif
 
return nil
 
//----------------------------------------------------------------------------//

FUNCTION CloseDatabase()
   oCn:Close()
RETURN NIL  

FUNCTION ConnectWithDatabase()
   ADOCONNECT oCn TO MYSQL SERVER localhost DATABASE <database> USER root PASSWORD <password> // PASSWORD ...
   
   if oCn == nil .or. oCn:State < 1
      MsgInfo( "Connect failed" )
      return nil
   endif        
 
   MsgInfo( "Connection Open" )
RETURN NIL
 
User avatar
pieter
 
Posts: 117
Joined: Thu Jan 08, 2015 9:27 am

Re: ADO RDD xHarbour

Postby Antonio Linares » Thu Jul 16, 2015 1:18 pm

James,

To create an Access database:

FW_CreateMdb( "test.mdb" )

To connect to it:

oCon = FW_OpenAdoConnection( "test.mdb" )

To create a table:
Code: Select all  Expand view
FWAdoCreateTable( "tableName", aFields, oCon, .T. )


Where aFields is the array that you get from DBStruct()
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: ADO RDD xHarbour

Postby James Bott » Thu Jul 16, 2015 10:10 pm

Pieter and Antonio,

I have already successfully created a table in the ACCESS database. Now I want to import data from a DBF to that table. The problem is that both APPEND BLANK and APPEND FROM error out. With a working RDD I should just be able to do:

use customer alias "cust"

append from SAMPLE.DBF via "DBFCDX"

But this isn't working. (See also my previous posts with the exact sample code I am trying to use.)

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: ADO RDD xHarbour

Postby pieter » Mon Jul 20, 2015 12:53 pm

Image
image url

I got this error when I pressed new from browse window.

This works:
APPEND BLANK
REPLACE FIELD->FIRST WITH "Pieter2"


This does not work:
APPEND FROM customer2.dbf via "DBFCDX"

Code: Select all  Expand view
Application
===========
   Path and name: C:\Pieter\adorddtest\adorddtest.exe (32 bits)
   Size: 2,769,408 bytes
   Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20150213)
   FiveWin  Version: FWHX 15.01
   Windows version: 6.2, Build 9200

   Time from start: 0 hours 0 mins 1 secs
   Error occurred at: 07/20/15, 14:46:29
   Error description: Error DBCMD/1005  Argument error: __DBAPP

Stack Calls
===========
   Called from:  => __DBAPP( 0 )
   Called from: adorddtest.prg => MAIN( 18 )

System
======
   CPU type: Intel(R) Pentium(R) CPU  N3540  @ 2.16GHz 2166 Mhz
   Hardware memory: 3500 megs

   Free System resources: 90 %
        GDI    resources: 90 %
        User   resources: 90 %

   Windows total applications running: 5
      1 ,                                                                                                    
      2 , C:\Windows\SYSTEM32\SHLWAPI.dll                                                                    
      3 , C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.9600.17810_none_7c5b6
      4 DDE Server Window, C:\Windows\SYSTEM32\OLE32.DLL                                                                      
      5 Tussen taken schakelen, C:\Pieter\adorddtest\adorddtest.exe                                                                

Variables in use
================
   Procedure     Type   Value
   ==========================
   __DBAPP
     Param   1:    C    "customer2.dbf"
     Param   2:    A    Len:    0
     Param   3:    U    
     Param   4:    U    
     Param   5:    U    
     Param   6:    U    
     Param   7:    L    .F.
     Param   8:    C    "DBFCDX"
     Param   9:    U    
     Param  10:    U    
     Local   1:    U    
     Local   2:    L    .T.
   MAIN

Linked RDDs
===========
   DBF
   DBFFPT
   DBFBLOB
   DBFNTX
   ADORDD

DataBases in use
================

  1: => CUSTOMER                           RddName: ADORDD
     ==============================
     RecNo    RecCount    BOF   EOF
          1          500      .F.   .F.

     Indexes in use                        TagName

     Relations in use

Classes in use:
===============
     1 ERROR
     2 HASHENTRY
     3 HBCLASS
     4 TOLEAUTO
     5 HBOBJECT
     6 TREG32

Memory Analysis
===============
      261 Static variables

   Dynamic memory consume:
      Actual  Value:          0 bytes
      Highest Value:          0 bytes






Code: Select all  Expand view
#include "fivewin.ch"
#include "adordd.ch"

    REQUEST ADORDD, ADOVERSION

    FUNCTION Main()

       RddRegister("ADORDD",1)
       RddSetDefault("ADORDD")
       
       SET ADO FORCE LOCK OFF   // Required!
       
      SET ADO DEFAULT DATABASE TO <database> SERVER TO "localhost"  ENGINE TO "MYSQL" USER TO "root" PASSWORD TO <password>
       
       USE CUSTOMER
       //APPEND BLANK
       //REPLACE FIELD->FIRST WITH "Pieter"     
       //APPEND FROM customer2.dbf via "DBFCDX"
       BROWSE()
   
    Return nil
User avatar
pieter
 
Posts: 117
Joined: Thu Jan 08, 2015 9:27 am

Re: ADO RDD xHarbour

Postby James Bott » Mon Jul 20, 2015 2:08 pm

Pieter,

The field HBRECNO has to be added to every table. It is an auto-increment field.

Search this forum topic for HBRECNO for more information. I still do not really understand its purpose, but it is needed, nor do I have the exact syntax for adding it to existing SQL databases. Maybe someone else can show us how.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: ADO RDD xHarbour

Postby James Bott » Sun Jul 26, 2015 12:41 am

The file() function does not seem to be working.

In the tryadordd.prg this function is used like this:

if !FILE("table1;northwind.mdb")

It always returns .F. even when the table exists. I also tried it with the preceding \ syntax (that is used elsewhere in the example program):

if !FILE("table1";\northwind.mdb")

It always returns .F. also.

And I do wonder about having to include the database name. If we have to do this then it is not syntax compatible with existing FW code. We would have to change all calls to File() in our programs. Or, does it use an existing default database if no database is specified? I also tried that:

if !FILE("Table1")

Which also returns .F. even when the table exists.

Comments anyone?

Regards
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: ADO RDD xHarbour

Postby James Bott » Tue Jul 28, 2015 5:51 am

Ok, some of the errors I have been reporting were due to another buildx.bat file that was in the path which was not linking in all three of the LIBs needed for the ADORDD. My bad.

I tried appending from a dbf to a SQL table (in an ACCESS) and it worked until it crashed at record 548. I am including the error log below. I'm at a loss at to what the problem might be.

The file I am trying to import has slightly more than 26000 records.

James

Code: Select all  Expand view
Application
===========
   Path and name: C:\Users\James\Documents\Projects\ADORDD\Test8.exe (32 bits)
   Size: 2,985,984 bytes
   Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20141106)
   FiveWin  Version: FWHX 15.05
   Windows version: 6.2, Build 9200

   Time from start: 0 hours 0 mins 48 secs
   Error occurred at: 07/27/15, 22:43:27
   Error description: Error ADODB.Connection/0  S_OK: EXECUTE
   Args:
     [   1] = C   UPDATE PTIME SET [REF] = '38739#'C' WHERE [HBRECNO] = 548

Stack Calls
===========
   Called from:  => TOLEAUTO:EXECUTE( 0 )
   Called from: adordd.prg => ADO_PUTVALUE( 1513 )
   Called from:  => __DBAPP( 0 )
   Called from: Test8.prg => MAIN( 52 )

System
======
   CPU type: AMD A8-4555M APU with Radeon(tm) HD Graphics    1600 Mhz
   Hardware memory: 3271 megs

   Free System resources: 90 %
        GDI    resources: 90 %
        User   resources: 90 %

   Windows total applications running: 3
      1 GDI+ Window,                                                                                                    
      2 GDI+ Window, C:\Windows\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.9600.17415_none_dad8722c5bcc2d
      3 Task Switching, C:\Users\James\Documents\Projects\ADORDD\Test8.exe                                                  

Variables in use
================
   Procedure     Type   Value
   ==========================
   TOLEAUTO:EXECUTE
     Param   1:    C    "UPDATE PTIME SET [REF] = '
38739#'C' WHERE [HBRECNO] = 548"
     Local   1:    U    
     Local   2:    C    "
ADODB.Connection"
   ADO_PUTVALUE
     Param   1:    N    1
     Param   2:    N    9
     Param   3:    C    "
'38739#'C'"
     Local   1:    A    Len:   37
     Local   2:    O    Class: TOLEAUTO
     Local   3:    N    548
     Local   4:    A    Len:    6
     Local   5:    U    
     Local   6:    U    
   __DBAPP
     Param   1:    C    "ptime"
     Param   2:    A    Len:    0
     Param   3:    U    
     Param   4:    U    
     Param   5:    U    
     Param   6:    U    
     Param   7:    L    .F.
     Param   8:    C    "DBFNTX"
     Param   9:    U    
     Param  10:    U    
   MAIN

Linked RDDs
===========
   DBF
   DBFFPT
   DBFBLOB
   DBFNTX
   ADORDD

DataBases in use
================

  1:    PTIME1                             RddName: ADORDD
     ==============================
     RecNo    RecCount    BOF   EOF
        548          548      .F.   .F.

     Indexes in use                        TagName

     Relations in use

Classes in use:
===============
     1 ERROR
     2 HASHENTRY
     3 HBCLASS
     4 TOLEAUTO
     5 VTWRAPPER
     6 HBOBJECT
     7 TREG32

Memory Analysis
===============
      368 Static variables

   Dynamic memory consume:
      Actual  Value:          0 bytes
      Highest Value:          0 bytes


User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: ADO RDD xHarbour

Postby pieter » Tue Jul 28, 2015 7:54 am

James Bott wrote:Pieter,

The field HBRECNO has to be added to every table. It is an auto-increment field.

Search this forum topic for HBRECNO for more information. I still do not really understand its purpose, but it is needed, nor do I have the exact syntax for adding it to existing SQL databases. Maybe someone else can show us how.

James


James, thanks, adding a field HBRENCO, solves the problem, when I press new in the window. However sometimes the window crashes, when I try to modify a record.

Have a nice day.

Pieter
User avatar
pieter
 
Posts: 117
Joined: Thu Jan 08, 2015 9:27 am

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Exabot [Bot] and 68 guests