日期:2014-05-20  浏览次数:20829 次

linq 转得我脑袋晕半天
如:
var query = from a in db.T_OnlineItems join b in db.T_CategoryItem
  on a.PagePath equals b.PK
  where a.Id.Equals(id)
  select new { b.ItemName };

PagePath为string类型,PK为int类型,怎么把这两个字段转换成相同的数据类型进行查询.


试过:b.PK.ToSting()无效

求解

------解决方案--------------------
Try:

System.Data.Objects.SqlClient.SqlFunctions.StringConvert((dobule)b.PK)
------解决方案--------------------
数据库中用的定长类型吧
Trim()试试