FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour FW_AdoImportFromDBF
Posts: 117
Joined: Thu Jan 08, 2015 09:27 AM

FW_AdoImportFromDBF

Posted: Fri Feb 20, 2015 03:18 PM
In my Xharbour application which is quite big, some of my code does not work, it looks like:
Code (fw): Select all Collapse
FW_AdoImportFromDBF( oCn,"C:\Pieter\dir1\TEST\customer.dbf")


If I run the code from scratch, then it works, but when I integrated it in my Xharbour application is does not work.

Anybody an idea why this is?

Part of the code looks like:
Code (fw): Select all Collapse
FUNCTION DBF2SQL()
   local oRs
   
   //CreateDatabaseIfNotYetExist()
   ConnectWithDatabase() //this connection with a mysql database works fine.
   
   MsgInfo( "import customer.dbf" )
   MsgInfo( File("C:\Pieter\dir1\TEST\customer.dbf") ) //gives T 
   FW_AdoImportFromDBF( oCn,"C:\Pieter\dir1\TEST\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
   
   CloseDatabase()
     
RETURN MsgInfo( "END.." )

FUNCTION CloseDatabase()
   oCn:Close()
RETURN NIL


The above code is based on the code of http://wiki.fivetechsoft.com/doku.php?i ... ortfromdbf.

note: The rest of the codes works perfectly, such as
Code (fw): Select all Collapse
oRs = TRecSet():New():Open( "customer", oCn )
, if a customer table is in mysql then it works.
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: FW_AdoImportFromDBF

Posted: Fri Feb 20, 2015 04:20 PM
Pieter,

Though we already tested this in Holland (I had the oportunity to visit Pieter's company this week to provide them a FWH + ADO seminar.
I also helped them to review the xHarbour to Harbour transition. It was a great pleasure to meet FWH users in real life :-) )
lets again carefully go for these tests:

After checking File( cDbf ) please insert this code:

Code (fw): Select all Collapse
USE (cDbf) NEW ALIAS SRCX SHARED READONLY VIA "DBFCDX"
if SELECT( "SRCX" ) == 0
  ? "Open fail"
else
  ? "ok. go ahead"
  CLOSE SRCX
endif
FW_AdoIm................
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 117
Joined: Thu Jan 08, 2015 09:27 AM

Re: FW_AdoImportFromDBF

Posted: Tue Feb 24, 2015 04:04 PM

Antonio,

It was a great FWH + ADO seminar that Antonio gave us :D, thank you for that. I will do some test later.

Have a nice day!

Best regards,

Pieter

Continue the discussion