我正在使用azure aql作为我正在编写的Windows手机应用程序的后端。我使用odata协议公开db,并使用odata客户端库来读写db。我在插入中文字符串时遇到问题。每个中国的角色都会出现“?”在数据库中。 以下是代码。使用调试器,我可以看出,在BeginSaveChanges调用之前,中文字符仍处于写入格式。 db中的相应字段定义为nvarchar。我可以从Web管理门户网站上找中文没问题。
NewJoke.Title = Regex.Replace(NewJoke.Title, "'", "''");
NewJoke.Content = Regex.Replace(NewJoke.Content, "'", "''");
dsc = new DataServiceContext(funnyJokesUri);
try
{
//Name of the entity goes into the first attribute of the AddObject method followed by the entity itself
//INSERTING
dsc.AddObject("Jokes", NewJoke);
dsc.BeginSaveChanges(insertJoke_Completed, dsc);
}
答案 0 :(得分:0)
我认为你必须在列上设置中文的排序规则。更多...... http://blogs.msdn.com/b/sqlazure/archive/2010/06/11/10023650.aspx
BTW - 我在阅读你的问题时并不清楚 - 听起来你说当你使用门户网站插入数据库时,数据库存储了中文版;但据推测,当您使用其他方法插入中文时,它不会存储中文。 (?)那就是你说的吗?