Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 21-04-2009
Member
 
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."
Reply With Quote
  #2  
Old 21-04-2009
Member
 
Join Date: May 2008
Posts: 2,293
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
Reply With Quote
  #3  
Old 21-04-2009
Member
 
Join Date: May 2008
Posts: 2,383
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.
Reply With Quote
  #4  
Old 21-04-2009
Member
 
Join Date: May 2008
Posts: 2,008
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;"
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Opening .DBF file using ADODB"
Thread Thread Starter Forum Replies Last Post
Cannot find file error when opening a file in Windows WalshJ Vista Help 18 16-06-2012 06:36 AM
Need file association with Run As for opening a file TheRyder Windows Software 3 03-03-2011 08:14 PM
A window appears: This file was not found while opening PDF file Algernon Windows Software 4 27-11-2010 05:59 AM
Types of Cursors in ADODB Jagdish Gada Software Development 4 28-11-2009 01:36 PM
ADODB 0x80020009 error problem Halyn Software Development 3 28-08-2009 06:50 PM


All times are GMT +5.5. The time now is 07:46 AM.