Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vfp, php and odbc 1

Status
Not open for further replies.

stfaprc

Programmer
Feb 10, 2005
216
US
Is there a version of the msVFP odbc that will allow for the use of a WHERE clause in a SQL-Select statement?

We need a php script to access a table in a dbc, but don't want all the records returned.
 
The latest ODBC driver was made with VFP7. And yes, where clauses are supported with it.

But you could also use the VFP OLEDB Provider from PHP like this:

Code:
$conn = new COM("ADODB.Connection") or die("Cannot start ADO"); 
$conn->Open("Provider=vfpoledb.1;Data Source=E:\data\some.dbc;Collating Sequence=machine");

and then do some sql with:

Code:
$query = "Select * from table where somefield = somevalue";
$result = $conn->Execute($query);
if ($result->EOF) { ... } 
else { $var = $result->Fields("fieldname")->Value;}

Just the normal stuff you do with $result sets.

Bye, Olaf.
 
OK, good.
now, where can i find an ODBC or OLEDB from vfp7 ?
the microsoft site just points me to the vfp9 versions.
unless, it is in one of the MDACs?

 
Hi stfaprc,

the wiki links point to a wiki entry about the ODBC and OLEDB drivers and you find a download link there in each article. This ensures someone will find the links in the future, if they change.

Here they are:
OLEDB: (download the msi file)
ODBC: (look on the right)

The VFP9 OLEDB Driver can access VFP7 databases and tables. I misinformed you about ODBC, the latest ODBC driver supports all features up to VFP6, if a database uses features introduced in VFP7 (eg databae events) or later (eg new field types like varchar), the ODBC driver will fail, but if those features are not used the ODBC driver can also access DBFs/DBCs created by VFP7,8 or 9.

In short, the OLE DB driver is all you need. You may also try the ODBC driver, if it performs better for you.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top