Posts

Showing posts with the label LINQ programming

Delete a specific row using LINQ

Here we are having a table in the Database name DBentities . The name of the table is Employee. here we are deleting a row where emplyee_id is emp_id var v = from row in dbentities.employee  where employee_id==emp_id select row if(v != null) { dbentities.employee.remove(v); }

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); }