Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2011
    Posts
    2

    Unanswered: AdoDB and Visual Foxpro (dbf) connection

    Hi

    I'm new here so forgive me if this is the wrong board, might be to post in the Databases board but oh well.

    So after hours of trying to connect to a Visual Foxpro data provider (thanks whoever made it this hard) I finally have a connection, but still cannot reach the table.

    What I have:

    a wamp server and php and adoDB for php package
    under c:/wamp/www

    I have a dbf.php

    under c:/wamp/www/test

    I have a dbf file called staru.DBF

    Now I'm trying to connect to this from the dbf.php file:

    Code:
    <?php
    $path = "adodb514/adodb5/adodb.inc.php";
    $path2 = "adodb514/adodb5/adodb-exceptions.inc.php";
    include($path);
    include($path2);
    try {
    $conn = new COM("ADODB.Connection");
    $conn->Open("Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=c:\wamp\www\test\staru.DBF;Exclusive=No;BackgroundFetch=No;");
    $rs = $conn->Execute("select * from staru");
    while ($array = $rs->FetchRow()) {
        print_r($array);
    }
    }
    catch (exception $e) {
        printf($e);
    }
    ?>
    What I get is:

    Code:
    exception 'com_exception' with message 'Source: Microsoft OLE DB Provider for ODBC Drivers
    Description: [Microsoft][ODBC Visual FoxPro Driver]File 'staru.dbf' does not exist.' in C:\wamp\www\dbf.php:9 Stack trace: #0 C:\wamp\www\dbf.php(9): com->Execute('select * from s...') #1 {main}
    Any ideas how to fix this? I'm on MS Server 2003

    Thank you in advance

  2. #2
    Join Date
    Sep 2009
    Location
    Ontario
    Posts
    1,057
    Provided Answers: 1
    One thing that I noticed is that the database name is "staru.DBF" (mixed case) in the source code, but "staru.dbf" (all lower case) in the error message.

  3. #3
    Join Date
    Dec 2011
    Posts
    2
    Quote Originally Posted by kitaman View Post
    One thing that I noticed is that the database name is "staru.DBF" (mixed case) in the source code, but "staru.dbf" (all lower case) in the error message.
    Yeah I actually tried most variations and renamed the file too but it didn't work.

    What I don't get is that there are no table names here, only file names so I have to use the file name in the SELECT statement because the sql needs it...

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •