views:

304

answers:

1
+3  Q: 

collation conflict

Is there any one who knows how we can solve collation issue in select linq query? I'm getting this error when I want to select data in linq.

Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AS" in the equal to operation

var lstData = from s in dataTrackDB.datas
              join b in dataTrackDB.brandDatas on i.brandcode equals b.brandcode
              join b in dataTrackDB.brandDatas on i.brandcode equals b.brandcode
              join b in dataTrackDB.brandDatas on i.brandcode equals b.brandcode
              join m in dataTrackDB.mktDatas on s.mktcode equals m.mktcode
              select new dataView { 
                  Account=m.account,
                  brandcode=b.brandcode,
                  commodity=s.commodity,
                  date=s.date,
                  daysvalid=s.daysvalid,
                  mfrcode=b.mfrcode,
                  mktcode=s.mktcode,
                  price=s.price,
                  prodid=s.prodid,
                  statecode=s.statecode,
                  subcommodity=s.subcommodity,
                  supprecode=s.supprecode,
                  units =s.units 
              };

lstData = lstData.AsQueryable().Where(x => x.mfrcode == mfr );

return lstData.Take(100).ToList();
+1  A: 

The problem is not in Linq but in your database

you can for example create a view that joins that way and the select the data in linq from the view

SELECT * FROM T1
INNER JOIN T2 ON 
T1.Name COLLATE Latin1_General_CI_AS = T2.Name COLLATE Latin1_General_CI_AS

or select the data first in linq2sql separately for each table and then join it with linq2object

gsharp