use DBF file with SQL

use DBF file with SQL

Postby damianodec » Thu Apr 18, 2019 10:41 am

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
damianodec
 
Posts: 419
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: use DBF file with SQL

Postby vilian » Thu Apr 18, 2019 10:51 am

IF you are using ADS(Advantage Database Server) it's easy:
Code: Select all  Expand view

SELECT 0
AdsCreateSQLStatement( "tmp", 2 )
AdsPrepareSql( cYourSqlStatment )
IF AdsExecuteSql()
  ...
ENDIF
 
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
 
Posts: 975
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: use DBF file with SQL

Postby damianodec » Thu Apr 18, 2019 11:14 am

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)
User avatar
damianodec
 
Posts: 419
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: use DBF file with SQL

Postby Marc Vanzegbroeck » Thu Apr 18, 2019 11:18 am

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

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: use DBF file with SQL

Postby damianodec » Thu Apr 18, 2019 11:29 am

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
damianodec
 
Posts: 419
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: use DBF file with SQL

Postby cnavarro » Thu Apr 18, 2019 11:43 am

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

viewtopic.php?f=3&t=26873&p=149080&hilit=FW_DBFSQLQUERY#p149080
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: use DBF file with SQL

Postby Marcelo Via Giglio » Thu Apr 18, 2019 12:55 pm

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
Marcelo Via Giglio
 
Posts: 1064
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: use DBF file with SQL

Postby damianodec » Wed Apr 24, 2019 5:49 am

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)
User avatar
damianodec
 
Posts: 419
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 78 guests