我正在尝试更改存储在数据库中的值,但我不确定如何做到这一点,
using (DataClassesDataContext dataContext = new DataClassesDataContext())
{
int accounttype = 1;
int id = 123;
//Search database for record based on round and player nummber
var query = (from r in dataContext.Tables
where r.accountType.Equals(accounttype)
where r.ID.Equals(Id)
select r);
//store player1s oppent in database
foreach (var record in query)
{
record.fund = 1234;
dataContext.Tables.InsertOnSubmit(record);
dataContext.SubmitChanges();
}
}
所以我试图在数据库中搜索特定记录并更改其值之一,但我似乎无法弄清楚如何更新它,但我知道“InsertOnSubmit”是错误的。