开发者

linq collation conflict issue

开发者 https://www.devze.com 2022-12-16 23:11 出处:网络
I\'m using linq to SQL and when I run this query var lstData = from s in dataTrackDB.datas join m in dataTrackDB.mkts on s.mktcode equals m.mktcode

I'm using linq to SQL and when I run this query

        var lstData = from s in dataTrackDB.datas
                      join m in dataTrackDB.mkts on s.mktcode equals m.mktcode
                      join n in dataTrackDB.mktnews on m.mktcode equals n.oldmktcode
                      select new data
                      {
                          AccountDes = m.account,
                          commodity = s.commodity,
                          date = s.date,
                          daysvalid = s.daysvalid,
          开发者_JAVA百科                mktcode = s.mktcode,
                          mktDes = n.mktdesc,
                          price = s.price,
                          prodid = s.prodid,
                          statecode = s.statecode,
                          subcommodity = s.subcommodity,
                          supprecode = s.supprecode,
                          units = s.units
                      };

I will get "Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AS" in the equal to operation" . I'd be thankful if someone guide me how should I write the linq query?

Thank you


The problem lies in collation of your columns in Database, change them to the same collation.

setting collation on columns could affect the comparison operators in sql.

http://www.sqldbadiaries.com/2010/10/31/changing-sql-server-collation/

http://blog.sqlauthority.com/2008/12/20/sql-server-change-collation-of-database-column-t-sql-script/

0

精彩评论

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