c# - Delete query in Linq -


i have simple code shows error. dont know going wrong. shows error in last line.."deleteonsubmit" linq_testdatacontext db = new linq_testdatacontext();

var remove = aremove in db.logins          aremove.username == usernamestring && aremove.password == pwdstring          select aremove; db.logins.deleteonsubmit(remove); 

you missing foreach loop delete entity.

use below

var remove = aremove in db.logins      aremove.username == usernamestring && aremove.password == pwdstring      select aremove; 

and after that

foreach (var detail in remove) {     db.logins.deleteonsubmit(detail); } 

and @ last

 try {     db.submitchanges(); } catch (exception e) {     // provide exceptions. } 

hope you.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -