vendredi 11 décembre 2015

Save Non English data using EntityFramework on MYSQl Database using MVC

I am using EntityFramwework approach in an MVC3 app to save & retrieve data I am playing with non English data in app

I try to save a new record to db as

  internal bool AddDept(DEPTModel model)
    {
        try
        {
          deptmaster db_itm=  new deptmaster { MalayalamName = model.MalayalamName, Name = model.Name };
          dbcontext.deptmasters.AddObject(db_itm);
            dbcontext.SaveChanges();
            return true;
        }
        catch
        {
            return false;
        }
    }

While putting break point and inspect model properties i can see my properties in nonEnglish language ("Malayalam") But after the completion of database insert query when i check db i can see only ????? inside table.

How can i make sure the same data from view is inserted to table

My column structre is

 ALTER TABLE deptmaster MODIFY MalayalamName VARCHAR(250) CHARACTER SET UTF8;

So if i manually edit table column using MySQL front its saving nonEnglish text

Aucun commentaire:

Enregistrer un commentaire