update tableX set fieldX = fieldX + 2!

Posts   
 
    
Stranger
User
Posts: 23
Joined: 22-Nov-2005
# Posted on: 04-Jul-2006 14:08:09   

There is a facility in SQL that u can increment a value in a command like following :

update tableX set fieldX = fieldX + 2

is there something in LLBLGen that update a table without fetch?

This work is done in LLBLGen as following :

1: FetchEntity(tableX) 2: tableX.fieldX = tableX.fieldX + 2 3: SaveEntity(tableX)

in this way, the concurrency problem will ocuured! because after execution of line 1, it is possible that the value of fieldX will change!

is there an alternative? thanks

Rogelio
User
Posts: 221
Joined: 29-Mar-2005
# Posted on: 04-Jul-2006 14:16:59   

Stranger wrote:

There is a facility in SQL that u can increment a value in a command like following :

update tableX set fieldX = fieldX + 2

is there something in LLBLGen that update a table without fetch?

This work is done in LLBLGen as following :

1: FetchEntity(tableX) 2: tableX.fieldX = tableX.fieldX + 2 3: SaveEntity(tableX)

in this way, the concurrency problem will ocuured! because after execution of line 1, it is possible that the value of fieldX will change!

is there an alternative? thanks

Hi,

Try creating an expression and assign it to the tablex.fieldx.expressionToUse property. The new expression would be: fieldx + 2. You can use the adapter.UpdateEentitiesDirectly or you can use the SaveEntity if you need to fetch the entity to do some work.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 04-Jul-2006 15:15:04   

Check the following thread, scroll down to see a code sample: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=2760