SQL compact 4 exception

不羁的心 提交于 2019-12-11 06:37:27

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!