How to fetch the image from database using linq , where image is stored in byte code in DataBase.

Here we are having a database model as dbtest, where pictures is the
Table name the Column name is img.
There is panel named ImgPanel where we are Getting the images

dbtestEntities db = new dbtestEntities();
var images = from p in db.Pictures
     select Image.FromStream(new MemoryStream(p.img.ToArray());

foreach (Image image in images)
{
    ImgPanel.Controls.Add(image);
}

Comments

Popular posts from this blog

How to use lamda expression for updating using LINQ

using session for login and logout in asp.net

How to post data in MVC using form collection for Beginners.