c# - Delete Id that has many values in link table -


i trying perform delete userid belongs linked table has many different areas user can belong to. linked table has userareaid , serviceareaid , when try , delete userid matches userareaid says sequence contains more 1 ... have made queryin linqpad selects the things want delete cannot go right iin actual project.

from t in tbl_user t.userid == 21 select new {      t.userid,      servicearea = new {t.userareatbl_userserviceareadetails},      userinfo = new{t.username,t.email} } 

i have tried foreach on query not enumerable. how should try , achieve this?

this whole of query set deleted flag true.

var deleterecord = (from t in db.tbl_userserviceareadetails                     ((t.tbl_user.userid == id) && (t.serviceareaid == id))                     )**** no method showing up?  if (deleterecord != null) {     deleterecord.tbl_user.deleted = true;      // submit     // ======     db.submitchanges();      // reload grid     // ===============     loadgrid(); 

try this:

foreach (var dr in db.tbl_userserviceareadetails.where(t => (t.tbl_user.userid == id) && (t.serviceareaid == id))) {     dr.tbl_user.deleted = true; } 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -