ADO RDD xHarbour
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: ADO RDD xHarbour
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
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
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: ADO RDD xHarbour
Vilian,
See postings 4, and 5 on page 27 of this message thread on solving issues with Harbour.
James
See postings 4, and 5 on page 27 of this message thread on solving issues with Harbour.
James
Re: ADO RDD xHarbour
James,
Thanks, but we decided make this migration using Tdolphin. It is more easy than I did think
Thanks, but we decided make this migration using Tdolphin. It is more easy than I did think
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: ADO RDD xHarbour
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
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
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: ADO RDD xHarbour
Antonio F,
I am attempting to import records from a DBF to an Access table. This crashes:
And this is the error:
The crash is happening at this line:
append from ptime via "DBFCDX"
Without that line it runs fine.
James
I am attempting to import records from a DBF to an Access table. This crashes:
Code: Select all
/*
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
Code: Select all
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 )
append from ptime via "DBFCDX"
Without that line it runs fine.
James
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: ADO RDD xHarbour
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.
James
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
/*
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 Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: ADO RDD xHarbour
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
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
Re: ADO RDD xHarbour
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
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
#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
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: ADO RDD xHarbour
James,
To create an Access database:
FW_CreateMdb( "test.mdb" )
To connect to it:
oCon = FW_OpenAdoConnection( "test.mdb" )
To create a table:
Where aFields is the array that you get from DBStruct()
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
FWAdoCreateTable( "tableName", aFields, oCon, .T. )
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: ADO RDD xHarbour
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
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
Re: ADO RDD xHarbour
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
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
#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
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: ADO RDD xHarbour
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
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 Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: ADO RDD xHarbour
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
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
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: ADO RDD xHarbour
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
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
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
Re: ADO RDD xHarbour
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.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
Have a nice day.
Pieter