I am trying connect to dbf file in 64 bit os using Microsoft.ACE.OLEDB.12.0 provider.
I wrote
[Test]
public void CustomDbfReader()
{
string filepath = @"K:\data";
var dataTable = new DataTable();
string connectionString =
"Provider=Microsoft.ACE.OLEDB.12.0;Extended Properties=dBASE IV;Data Source='" + filepath +"'" ;
using (var oledbConnection = new OleDbConnection(connectionString))
{
oledbConnection.Open();
string stringCommadn = string.Format(@"select * from filename.dbf");
var oleDbCommand = new OleDbCommand(stringCommadn, oledbConnection);
var oleDbDataAdapter = new OleDbDataAdapter
{
SelectCommand = oleDbCommand
};
oleDbDataAdapter.Fill(dataTable);
}
Assert.IsNotEmpty(dataTable.Rows);
}
I get this exception
System.Data.OleDb.OleDbException : The Microsoft Access database engine could not find the object 'CardifOrigin.dbf'. Make sure the object exists and that you spell its name and the path name correctly. If 'CardifOrigin.dbf' is not a local object, check your network connection or contact the server administrator.
I am sure both path and file name exist.
What's the problem?