c# - How can I find that a record successfully deleted from Db using LINQ -


i'm using linq-to-sql, , wrote block delete record in database. executenonquery returns integer value, , value can find if record deleted or not. how can linq? example in code:

aspnetdbdatacontext aspdb = new aspnetdbdatacontext();             var res=from p in aspdb.trackpoints                         p.routefk==routeid                         select p;             aspdb.trackpoints.deleteonsubmit(res.first());             aspdb.submitchanges(); 

system.data.linq.changeset cs = aspdb.getchangeset(); bool isdeleted = cs.deletes.count() == 0; 

here if cs.deletes equal 0 means has been ok , row deleted if greater zero, mean there records have not been deleted successfully


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -