views:

979

answers:

2

I have a binary file which stores in the customerPicture column that has Image as a datatype in the CUSTOMERs table.

I have saved an image by using this line of code in LINQ to SQL.

Dim db = new MyCompanyDataContext
Dim newCus = new CUSTOMERs
Dim filebyte As Byte() = fileUploader.FileBytes
Dim fileBinary As New System.Data.Linq.Binary(filebyte)
newCus.customerPicture = fileBinary

Then now I want to retrieve this binary file to bind in the gridview in ASP.NET by using LINQ to SQL, but I don't know how. Can you please show me some ways to reach the solution?

A: 

Try this:

dim ms as new MemoryStream
ms.Write(fileBinary.ToArray(),0,fileBinary.Length)

dim img as Image
img = Image.FromStream(ms)

newCus.customerPicture = img
TheVillageIdiot
A: 
Mani