Page 1 of 1

use DBF file with SQL

PostPosted: Thu Apr 18, 2019 10:41 am
by damianodec
Hi
I would like to use SQL with a DBF file
any help?

thank you

Re: use DBF file with SQL

PostPosted: Thu Apr 18, 2019 10:51 am
by vilian
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
 

Re: use DBF file with SQL

PostPosted: Thu Apr 18, 2019 11:14 am
by damianodec
hi Vilian,
No, I do not use Ads, it's a simple file.dbf with file.cdx
thank you

Re: use DBF file with SQL

PostPosted: Thu Apr 18, 2019 11:18 am
by Marc Vanzegbroeck
Do you mean running SQL-commands on a DBF-database?

Re: use DBF file with SQL

PostPosted: Thu Apr 18, 2019 11:29 am
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.

Re: use DBF file with SQL

PostPosted: Thu Apr 18, 2019 11:43 am
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

viewtopic.php?f=3&t=26873&p=149080&hilit=FW_DBFSQLQUERY#p149080

Re: use DBF file with SQL

PostPosted: Thu Apr 18, 2019 12:55 pm
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

Re: use DBF file with SQL

PostPosted: Wed Apr 24, 2019 5:49 am
by damianodec
thank you,
I solved with Navarro.