Everything was working fine while the database of my asp.net mvc 2 site was in the app_data folder, after I transfered it to sqlserver express all the Cyrillic data I added after that appears in ?????
I'm using nvarchar for my fields and collation is set to Cyrillic and yet I get ?????
...
Any suggestions are appreciated
[HttpPost]
public ActionResult AddCity(CityInfo cityInfo)
{
try
{
// TODO: Add insert logic here
if (ModelState.IsValid)
{
var dbM = new moonDB2();
dbM.CityInfoes.AddObject(cityInfo);
dbM.SaveChanges();
return RedirectToAction("Index");
}
else
{
return View(cityInfo);
}
开发者_Python百科 }
catch
{
return View();
}
}
I'm using nvarchar for my fields and encoding is set to Cyrillic
Irrelevant. NVarchar is unicode - so the encoding is not relevant. Encoding is relevant for varchar (coding page) only.
- Validate it is the database, not the asp.net area
- Are you ENCODING the letters in ASP.NET? What is your server side asp.net locale?
I am more likely to believe you f***** up the string handing in the ASP.NET side, or run thecode somewhere through a CHAR / VARCHAR columns. NVARCHAR handles cyrillic fine.
You need to set your EntityDataModel
string
property's Unicode
Facet to true
.
精彩评论