Cannot convert from 'System.Data.Linq.Binary' to 'System.IO.BinaryReader'

my table column:

AttachContent varbinary (max) 

when i try to get data and i get this below error i use linq

cannot convert from 'System.Data.Linq.Binary' to 'System.IO.BinaryReader'

+4
source share
1 answer

System.Data.Linq.Binary contains an array of bytes. You can use it directly as follows:

 Binary binary = //your linq object byte[] array = binary.ToArray(); 

If you must have a BinaryReader in a byte array, you can wrap it as follows:

 BinaryReader reader = new BinaryReader(new MemoryStream(binary.ToArray())); 
+8
source

All Articles