Subsonic 3.0 UPDATE, multiple conditions

痴心易碎 提交于 2019-12-24 08:57:17

问题


      db.Update<Luna.Record.TB_ITEM>().Set(
                x => x.ITEM_DURABILITY == Convert.ToInt32(quantity))
                .Where(x => x.ITEM_POSITION == Convert.ToInt32(position))
                .Execute();

How will I add an AND clause this is how it looks like in plain SQL:

UPDATE TB_ITEM
SET ITEM_DURABITLITY=@quantity
WHERE ITEM_POSITION=@position AND CHARACTER_IDX=@charidx

回答1:


.Where(x => x.ITEM_POSITION == Convert.ToInt32(position)
            && x.CHARACTER_IDX == Convert.ToInt32(charidx)) 


来源:https://stackoverflow.com/questions/2623115/subsonic-3-0-update-multiple-conditions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!