Reputation: 9
bool check = false;
try
{
var rows = (from s in db.logins
where s.user_email == id && s.user_password == password
select s).First();
if (rows.user_email==id)
{
check = true;
login login = new login();
login.status= 1;
db.SubmitChanges();
}
}
catch (Exception e)
{
}
return check;
i am trying to authenticate username password .if username password matches it automatically update status to 1 for same user in db.it matches the username and password .but unable to update it.
Upvotes: 0
Views: 99
Reputation: 31800
Try this:
var rows = (from s in db.logins
where s.user_email == id && s.user_password == password
select s).First();
rows.status = 1;
db.SubmitChanges();
Unfortunately the .net common language runtime which inhabits this dimension of reality requires that changes made to an object completely unrelated to another object cannot magically appear in that other object without the intervention of pixies and unicorns.
Upvotes: 2