I’m using LINQ-to-Sql, and I wrote a block to delete a record in database. Executenonquery returns an integer value, and with this value we can find if this record is deleted or not. But how can we do that with Linq? for example in my code:
aspnetdbDataContext aspdb = new aspnetdbDataContext();
var res=from p in aspdb.TrackPoints
where p.RouteFK==routeId
select p;
aspdb.TrackPoints.DeleteOnSubmit(res.First());
aspdb.SubmitChanges();
here if cs.Deletes is equal to zero it means everything has been ok and the row is deleted but if it is greater than zero, it mean that there are some records that have not been deleted successfully