Reputation: 25
I want to recreate the following SQL Update Command in LINQ to DB (Linq2DB).
UPDATE MyTable
SET TextColumn = CONCAT(TextColumn, char(13), char(10), 'New Text')
WHERE TextColum IS NOT NULL
I don't know how to implement this with Linq2Db because I don't know how to get access to the Column to use it as a Value.
using (var db = new DbNorthwind())
{
db.MyTable
.Where(p => p.TextColumn != null)
.Set(p => p.TextColumn, ???)
.Update();
}
Upvotes: 0
Views: 359
Reputation: 27366
Nothing special here, just repeat what to do with column.
using (var db = new DbNorthwind())
{
db.MyTable
.Where(p => p.TextColumn != null)
.Set(p => p.TextColumn, p => p.TextColumn + "New Text")
.Update();
}
Upvotes: 3