Novkovski Stevo Bato
Novkovski Stevo Bato

Reputation: 1043

Image data type to byte array

According to this tutorial , he have 'image' data type to store file bytes. Then, on download action, he just get that image data type value as byte[], but I have problem in my solution.

I'm using SQL 2008, LinqToSQL.

Row screenshot

DB Row

C# screenshot

c#

Error message enter image description here

P.S This is my first time to work with 'save files to db'.

Upvotes: 0

Views: 5053

Answers (1)

SLaks
SLaks

Reputation: 887453

As the error clearly states, AttchDB is a Binary, not a byte.

You can call .ToArray() to get the raw byte[] data.

Upvotes: 5

Related Questions