Results 1 to 4 of 4

Thread: Opening .DBF file using ADODB

  1. #1
    Join Date
    Feb 2009
    Posts
    45

    Opening .DBF file using ADODB

    hi,
    I am trying to open a Data base File using VB6 ADODB connection. the problem is whenever i try to run i get the error message "Path is not a valid path. Make sure that the path is spelled correctly and that you are connected to the server on which the file resides."

  2. #2
    Join Date
    May 2008
    Posts
    2,297

    Re: Opening .DBF file using ADODB

    We can use several providers to open DBF files usind ADODB. Basic way is to use ODBC data source (DSN or DSNless), there is several samples published on web. But how to open DBF files without ODBC? There are two other OLEDB providers, using which you can work with DBF files. One of them is Microsoft.Jet.OLEDB.
    Key property to work with DBF files is "Extended Properties" - there is no much info about this parameter in documentation. This parameter has similar meaning as connect parameter in DAO OpenDatabase method. First work is to open connection to DBASE IV files:

    Function OpenDBFConn(Path)
    Dim Conn: Set Conn = CreateObject("ADODB.Connection")
    Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=" & Path & ";" & _
    "Extended Properties=""DBASE IV;"";"
    Set OpenDBFConn = Conn
    End Function

  3. #3
    Join Date
    May 2008
    Posts
    2,389

    Re: Opening .DBF file using ADODB

    Are you sure it's a dBASE III file? A .dbf file could also be a FoxPro table. And FoxPro has grown away from dBASE where the files can now be incompatible with older lowest common denominator dBASE III drivers.

  4. #4
    Join Date
    May 2008
    Posts
    2,012

    Re: Opening .DBF file using ADODB

    You should be able to open the DBF directly with ADO.Net using either of the following connection string templates:

    OLE DB:
    "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\folder;Extended Properties=dBASE IV;User ID=Admin;Password="

    ODBC:
    "Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=c:\mydbpath;"

Similar Threads

  1. Replies: 18
    Last Post: 16-06-2012, 06:36 AM
  2. Need file association with Run As for opening a file
    By TheRyder in forum Windows Software
    Replies: 3
    Last Post: 03-03-2011, 08:14 PM
  3. Replies: 4
    Last Post: 27-11-2010, 05:59 AM
  4. Types of Cursors in ADODB
    By Jagdish Gada in forum Software Development
    Replies: 4
    Last Post: 28-11-2009, 01:36 PM
  5. ADODB 0x80020009 error problem
    By Halyn in forum Software Development
    Replies: 3
    Last Post: 28-08-2009, 06:50 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,018,891.15462 seconds with 17 queries