问题
I have a windows form application written in C# and running on a Windows XP machine with SQL compact 4 database. The operating system language is simplified chinese. I'm facing a strange exception. "The specified locale is not installed on this machine. Make sure you install the appropriate language pack. LCID 1053" Why? The application does work ok on all other configurations/languages.
回答1:
That is the locale for Sweden. You can change the locale by modifying the connection string:
http://msdn.microsoft.com/en-us/library/ms174034.aspx
so it would be something like
conString = "....;Locale Identifier=XXXX;..."
where the XXXX can be found on this table: http://msdn.microsoft.com/en-us/goglobal/bb964664
回答2:
I had the same problem SDF created in win8 with version 4.0 and it was not working in XP.
Then I repaired the DB with the following C# code, now its working in both OSs.
SqlCeEngine se = new SqlCeEngine(@"Data Source=|DataDirectory|\mydatabase1.sdf;Persist Security Info=False;");
se.Repair(@"Data Source=|DataDirectory|\mydatabase1.sdf;Persist Security Info=False;", RepairOption.RecoverAllOrFail);
来源:https://stackoverflow.com/questions/8477339/sql-compact-4-exception