我试图通过LINQ选择从我的数据库的image
列,并将其保存到q3
无法将类型“System.Linq.IQueryable <System.Data.Linq.Binary>到字节
-------------------------------
| table : admin |
-------------------------------
| username | password | image |
-------------------------------
查询:
var q3 = alnq.tbl_Admins.Where(c => c.fld_UserName == userName).Select(c => c.fld_Image);
当我想这个查询转换为字节数组,我得到一个错误:
byte [] DbImageByte = q3.ToArray();
错误:
Cannot implicitly convert type 'System.Data.Linq.Binary[]' to 'byte[]'
什么类型是'fld_Image'? –
它是varbinary(最大) – user3319756
您可以请尝试添加.FirstOrDefault()后.select()?然后检查 –