这是我的代码:
var items = tableInDatabase.All("WHERE [Order] > " + order);
foreach (var i in items.ToArray())
{
i.Order = 7;
}
tableInDatabase.Save(items.ToArray());
However, when the breakpoint comes to the last line (after the foreach loop), every element of items has an order the same as before (not 7). Why is this happening? While still in the loop, i has an order of 7.
我使用大规模, 这是官方网页上的例子:
var table = new Products();
var drinks = table.All("WHERE CategoryID = 8");
foreach(var item in drinks.ToArray()){
item.CategoryID = 12;
}
table.Save(drinks.ToArray());
我也试过:
foreach (var i in items.ToArray())
{
tableInDatabase.Update(i, i.Id);
}
什么都没有
返回类型 od 表InDatabase 是类表InDatabase。这是定义 :
public TableInDatabase() : base(connectionString, "System.Data.SqlClient", "TableInDatabase", "Id") { }