SqlSugar常用操作
1,update
var t10 = db.Updateable<Student>() .UpdateColumns(it => new Student() { Name = "a", CreateTime = DateTime.Now }) .Where(it => it.Id == 11).ExecuteCommand();
根据实体主键更新相应字段
//执行操作 if (Db.Updateable(carModel). UpdateColumns(it=>new {it.GoodsCount,it.GoodsPrice}).ExecuteCommand() <= 0) { return new ResponseModel("99", "操作异常!"); }
更新list数据
//更新购物车数量 if (Db.Updateable(list) .UpdateColumns(it => it.GoodsCount) .ExecuteCommand() <= 0)
Db.Updateable(list).UpdateColumns(it => new T_SellWellCar { GoodsPrice = it.GoodsPrice }).ExecuteCommand()

浙公网安备 33010602011771号