Search code examples
c#ms-accessoledbcultureinfo

OleDbConnection/Command to DB with locale specific character


I have MS Access DB with table what contains Columns which Names has Danish characters. e.g. Døbt

When program works on PC with Danish location everything works fine, but at PC with Ukrainian location I got error that field Dжbt is missing. Seems that char ø comes to me from DB as ж

Code that fires error at last line:

var connection = new OleDbConnection();
connection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\\STAT.MDB";
var table = new DataTable( "NewTable" );
table.Locale = CultureInfo.GetCultureInfo( "da-DK" ); 
var adapter = new OleDbDataAdapter( "SELECT Døbt FROM Table", connection );
adapter.Fill( table );

Is there some way to set target Culture for connection or something else?


Solution

  • I think the problem is not with the connection but with the fact that the machine you are running this on doesn't not use the correct character set, there may be an update you can download that will allow the Ukrainian location settings to read Danish characters