我在WPF / C#应用程序中尝试此查询:
var listaPechatari = from p in pe.Pechataris
join vp in pe.VidPechatars on p.VidPechatarID equals vp.VidPechatarID
select vp.VidPechatarIme + " " + Convert.ToString(p.PechatarOznaka);
其中 pe 是 PrintingEntities 又名 EDMX 数据模型。 我得到的问题是, p.PechatarOznaka 在MS SQL Server 2008中的类型为 byte(tinyint)。我得到一个例外:
{"LINQ to Entities does not recognize the method 'System.String ToString(Byte)' method, and this method cannot be translated into a store expression."}
我需要显示打印机的名称及其标签。
类似“HP Laser Jet 9000 5”,其中数字5是字节类型,它是打印机的标签。
我做错了什么?或者是否有更好的方法来组合并在组合框ItemSource中显示打印机的名称及其标签?