0

I have a db with one table, in table I have fields(id,name,place,course,homework,score)

public class LoginTable
{
   [PrimaryKey, AutoIncrement, Column("_Id")]
   public int id { get; set; }

   public string name{ get; set; }
   public string place{ get; set; }
   public string course{ get; set; }

   public string homework{ get; set; }
   public string score{ get; set; }

Now I want to change values field (score) for all row in table with this term:

var data1 = data.Where(x => x.name == "a" && x.place == "b");
if (data1 != null)
{ HELP ME HERE !!!!" HOW CALL ALL ROW of Table(DB) HERE  AND CALCULATE SCORE (UPDATE FIELDS SCORE)" }

I don't know whats written in if {}! Note: I want to calculate new score with this function: score+homework=(new)score

enter image description here

1

1 Answer 1

1

In Sqlite use,

dbContext.InsertOrReplace(data)
or
dbContext.Update(data)

Update:

var data1 = data.Where(x => x.name == "a" && x.place == "b");
foreach(var item in data1)
{
     item.score = /*your value*/
     dbContext.Update(item);
}
Sign up to request clarification or add additional context in comments.

2 Comments

please see uupload.ir/files/xog7_capture.jpg .i want change score when var data1 = data.Where(x => x.name == "a" && x.place == "b"); if (data1 != null){ whats write here}
Please mark as answer and upvote if you find it useful and help others to show the answer helped you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.