FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour use DBF file with SQL
Posts: 434
Joined: Wed Jun 06, 2007 02:58 PM
use DBF file with SQL
Posted: 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 24.02 - Feb. 2024 - Embarcadero C++ 7.60 for Win32 Copyright (c) 1993-2023

FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)

Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: use DBF file with SQL
Posted: Thu Apr 18, 2019 10:51 AM
IF you are using ADS(Advantage Database Server) it's easy:
Code (fw): Select all Collapse
SELECT 0
AdsCreateSQLStatement( "tmp", 2 )
AdsPrepareSql( cYourSqlStatment )
IF AdsExecuteSql()
  ...
ENDIF
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 434
Joined: Wed Jun 06, 2007 02:58 PM
Re: use DBF file with SQL
Posted: 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 24.02 - Feb. 2024 - Embarcadero C++ 7.60 for Win32 Copyright (c) 1993-2023

FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)

Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: use DBF file with SQL
Posted: 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
Posts: 434
Joined: Wed Jun 06, 2007 02:58 PM
Re: use DBF file with SQL
Posted: 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 24.02 - Feb. 2024 - Embarcadero C++ 7.60 for Win32 Copyright (c) 1993-2023

FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)

Visual Studio 2019 - Pelles C V.8.00.60 (Win64)
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: use DBF file with SQL
Posted: 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
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: use DBF file with SQL
Posted: 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
Posts: 434
Joined: Wed Jun 06, 2007 02:58 PM
Re: use DBF file with SQL
Posted: Wed Apr 24, 2019 05:49 AM

thank you,
I solved with Navarro.

FiveWin for xHarbour 24.02 - Feb. 2024 - Embarcadero C++ 7.60 for Win32 Copyright (c) 1993-2023

FWH 64 for Harbour 19.06 (MSVC++) Jun. 2019 - Harbour 3.2.0dev (r1904111533)

Visual Studio 2019 - Pelles C V.8.00.60 (Win64)

Continue the discussion