Partager via


Does the VFP ODBC driver support subdirectories?

I received a question from a customer:

I don't know how to search for this but does ODBC, specfically Visual FoxPro support opening tables in a subdirectory?

ODBC is very old.. OLEDb is much more recent.

In any case, the answer is yes, the ODBC driver supports opening files in subdirectories.

If you want to access data on other paths, one way is to make another connection.

cPath="d:\fox90\test"

h=SQLSTRINGCONNECT("Driver=Microsoft Visual Foxpro Driver;SourceType=dbf;SourceDB="+cPath)

?h

IF h>0

      ?SQLEXEC(h,"Select * from customer") && retrieve customer table

      MD (cPath+"\Subdir") && Make a subdir

      SELECT DISTINCT city FROM customer INTO TABLE (cPath+"Subdir\cities")

      USE IN cities && close the cities table

      ?SQLEXEC(h,"Select * from "+cPath+"\Subdir\cities")

      LIST next 10

ENDIF

SQLDISCONNECT(0) && Disconnect all

Comments