Query DBF files

Hi,

I would need to read data from and also write data to DBF files. I’m using ODBCConnection without problems. I see all tables, fields in tables.

It seems that ODBCQuery class SQL method does not work with the DBF files, so I do not know how to query the files, get the result and write back the recaltulated data.

I’m trying to use the following codes:

Dim con As New ODBCConnection

Dim qry As New ODBCQuery

Dim result As New ODBCResultSet

con.ConnectTo(“products”)

qry.sql="SELECT * FROM PRODUCT

result.Execute

If result.IsResultSetAvailable Then

Else

Msgbox “NULL result”

End if

The PRODUCT.DBF file is not empty (there are only about 10 records only for testing), but I get the msg “NULL result”. So it says to me that the problem is with SQL. Is it possible to use SQL with DBF? Should I install additional programs or drivers?

Thanks for help.

Etyien

Subject: query DBF files

A long short here but a few things I would try. Can you open the DBF file in Access, or import it into an Access MDB file? Or possibly create a linked table from access… Validate your sql there.

However it seems you are performing a simple sql SELECT statement.

Try creating a DSN for the database, and using ADO to perform your data intergation (which is my personal preference since I know ADO fairly well.)

Regards,

Mike Robinson

http://www.invcs.com

Subject: RE: query DBF files

Hi Michael,

DBF reading process is supposed to run scheduled by an agent, so I am afraid I can not use Access.

I do not know ADO. Could you tell me a few words about it?

Thanks.

Etyien