Tuesday, September 24, 2013

How To Delete table row in sql database by LINQ query?

First of all get the row form id 

This is a method for delete row from summary table.

So here I pass id for which I want to delete the row

This is database context 

private UserContext database = new UserContext("UserConnection");

table name :summeries

   public ActionResult del_summary(int id = 0)
            var summary_delete = database.summeries.Find(id);

            var delete = database.summeries.Remove(summary_delete);


            return RedirectToAction("ExceptionListing");


It will delete row from table.

Thanks for visiting.Please comment here if you have any query regarding it.

No comments:

Post a Comment