开发者

I have problem with hebrew in Mysql. I use with visualstudio10, connector and linq. what can i do?

开发者 https://www.devze.com 2023-03-06 02:22 出处:网络
the query works well only in english. *the tables and all DB is utf-8(utf-8_general_ci) I see hebrew in the db(phpmyadmin or mysq开发者_开发技巧l Workbench)

the query works well only in english. *the tables and all DB is utf-8(utf-8_general_ci) I see hebrew in the db(phpmyadmin or mysq开发者_开发技巧l Workbench) the problem is to read VALUES from the db.

*I use linqtosql to do the query and the model is EntityFramework.

this is a sample:

        using (dbEntities model = new dbEntities())
        {            

            List<string> lstNoth = new List<string>();                
            var query = from t in model.producttype                           
                        where t.ProductTypeName.Contains(text)
                        select new
                        {                                
                           t.ProductTypeName
                        };

            foreach (var item in query) //value in hebrew didn't get inside.
            {
                lstNoth.Add(item.ProductTypeName);
            }
        }


I found the solution. I add the sentence- charset=utf8 to the connectionString in WebConfig.

database=XXXX;charset=utf8 

The problem solved. Thanks anyway for your help.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号