开发者

Update a column value based on another column value with SubSonic 2.1/2.2

开发者 https://www.devze.com 2022-12-08 07:42 出处:网络
I have the following code using SubSonic 2.开发者_如何学Python1/2.2 SubSonic.Update(<some table>)

I have the following code using SubSonic 2.开发者_如何学Python1/2.2

SubSonic.Update(<some table>)
.Set(<column A>)
.EqualTo(<column B>).
Where(condition...).Execute()

I would like to change it to update "column A" with the value of "column B" + 1. How can I do it with this syntax.

Is there a better SubSonic syntax to achieve the same thing:

ColumnA = ColumnB + 1

Or even

ColumnA = ColumnA + a


Using SetExpression instead of Set will solve the problem

SubSonic.Update(<some table>)
.SetExpression("columnA")
.EqualTo("columnB + 1").
Where(condition...).Execute()
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号