I found that the accepted answer does not work for me, because the .dbf files I work with are nested in a directory hierarchy that makes the paths quite long, which unfortunately calls the OleDbCommand object.
I found a neat little library that needs only the file path to work. Here is a small example adapted from the examples on his GitHub page:
var file = "C:\\Path\\To\\File.dbf"; using (var dbfDataReader = new DbfDataReader(file)) { while (dbfDataReader.Read()) { var foo = Convert.ToString(dbfDataReader["FOO"]); var bar = Convert.ToInt32(dbfDataReader["BAR"]); } }
Alexis Leclerc
source share