Performing bulk updates in a friendly (and safe) manner

Posts   
 
    
JSobell
User
Posts: 145
Joined: 07-Jan-2006
# Posted on: 14-Jul-2022 02:53:31   

Is there a way to perform a statement such as

update myRecords SET type=99 WHERE username='Fred'

without calling with a raw TSQL command? I'm using the LinqMetadata approach for most of my solutions, but what is a suitable way to at least build an appropriate WHERE clause to pass to the execution?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 14-Jul-2022 08:45:10   

Updating entities directly in the database is done with the UpdateEntitiesDirectly API on the dataaccessadapter class, see https://www.llblgen.com/Documentation/5.9/LLBLGen%20Pro%20RTF/Using%20the%20generated%20code/Adapter/gencode_usingentityclasses_modifying.htm#using-updateentitiesdirectly

Not linq, but you can use the QuerySpec extension methods to formulate the predicate, so the where clause in your example is then constructed as: MyRecordFields.Username.Equal("Fred")

Frans Bouma | Lead developer LLBLGen Pro