This error indicates that the collection returned by LINQ is a System.Data.Linq.Binary
object and you cannot use it to initialize the byte[]
, nor to convert it explicitly.
First, you need to convert it to the array, use the LINQ's built-in ToArray()
function.
Use
byte[] sqlbinary = login.FirstOrDefault().Password.ToArray();
It should be just fine.