I am reading a DBF file using OleDb as follows:
[TestMethod] public void TestMethod2() { const string path = @"D:\VL816183.DBF"; var connection = new OleDbConnection(string.Format("Provider=Microsoft.Jet.Oledb.4.0;Data Source={0};Extended Properties=\"dBase IV\"", Path.GetDirectoryName(path))); connection.Open(); var command = new OleDbCommand(string.Format("select MNO from {0}", Path.GetFileName(path)), connection); using (var reader = command.ExecuteReader()) { while (reader.Read()) { var str = (string)reader["MNO"]; } } connection.Close(); }
Everything seems to be in order, but there is a problem with the string data. The original database contains rows stored using CodePage = 852 , and I cannot find a way to read it correctly.
I tried to set CharSet / CodePage / CharacterSet in the extended properties of the connection string, but with no luck (in fact, an exception was thrown: it was not possible to find the installed ISAM).
I also tried to read it using the "vfpoledb" provider, still no luck.
For example, there is the string "FRANTIŠEK", but the str variable contains "FRANTIμEK".
Does anyone know how to do this? Thanks
user439931
source share