use DBF file with SQL

Post Reply
User avatar
damianodec
Posts: 372
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia
Contact:

use DBF file with SQL

Post by damianodec »

Hi
I would like to use SQL with a DBF file
any help?

thank you
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
vilian
Posts: 795
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Contact:

Re: use DBF file with SQL

Post by vilian »

IF you are using ADS(Advantage Database Server) it's easy:

Code: Select all

SELECT 0
AdsCreateSQLStatement( "tmp", 2 )
AdsPrepareSql( cYourSqlStatment )
IF AdsExecuteSql()
  ...
ENDIF
 
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
damianodec
Posts: 372
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia
Contact:

Re: use DBF file with SQL

Post by damianodec »

hi Vilian,
No, I do not use Ads, it's a simple file.dbf with file.cdx
thank you
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Re: use DBF file with SQL

Post by Marc Vanzegbroeck »

Do you mean running SQL-commands on a DBF-database?
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
User avatar
damianodec
Posts: 372
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia
Contact:

Re: use DBF file with SQL

Post by damianodec »

hi Marc,
I have my single file ORDINI.DBF with index ORDINI.CDX, I don't want to use Clipper command or function: DbUseArea, DbSetIndex, DbSkip, Dbseek...
I'd like to use for this file a simple SQL command "Select * from ORDINI.DBF WHERE..." and then to use fields.
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: use DBF file with SQL

Post by cnavarro »

You can use DBF with SQL statements, using ADO, but it will not allow you to use its indexes.
But you can use the function FW_DBFSQLQUERY

http://forums.fivetechsupport.com/viewt ... RY#p149080
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Marcelo Via Giglio
Posts: 1033
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: use DBF file with SQL

Post by Marcelo Via Giglio »

Hello,

you can use ADS with DBF/CDX

try to download this sample https://app.box.com/s/r0w5vgxzugucoavqjzpba9he6625gvgu

1.- for a sample define path ./
2.- conectar
3.- in Consulta SQL type select * from customer + ejecutar

regards

Marcelo

P.D.

https://app.box.com/s/t2vd0tfrov42usp1kzgucxxs642bmigx
User avatar
damianodec
Posts: 372
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia
Contact:

Re: use DBF file with SQL

Post by damianodec »

thank you,
I solved with Navarro.
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)
Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
Post Reply