Incrementing a db col

Posts   
 
    
Jackk100
User
Posts: 48
Joined: 11-Jan-2005
# Posted on: 14-Apr-2005 18:44:03   

Hi,

I'm wondering if there's a way to do this (using adapter) without having to fetch the entity, read it's property and then update it:

update SomeTable set ColA = ColA + 1 where ID = 1234

(ie, increment ColA's number up one)

Thx, Jack

Rogelio
User
Posts: 221
Joined: 29-Mar-2005
# Posted on: 15-Apr-2005 00:32:34   

Hi,

Yes, just create a new entity, IpredicateBucket and Expression. Assign the Expression to ColA(field) 's ExpressionToApply property, then use the Adapter.UpdateEntityDirectly(entity, IPrecicateBucket)

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 15-Apr-2005 09:11:04   

Thanks Rogelio. simple_smile

An example of this in more detail is in the documentation, please check: "Using the generated code -> Field expressions and aggregates -> Expressions in entity updates"

Frans Bouma | Lead developer LLBLGen Pro