Hey,
I have 2 different type of changes that I need to do on a datatable
Update all specific column values to new value, for example
the original datatable
A B C
1 3
2 4
the new datatable
A B C
1 3 OK
2 4 OK
Update column value when the value contain 2 different type of string (I cant use equal), for example if the value in column ‘C’ contain ‘OK’ or contain Value’ to update those row(‘C’) to ‘Done’
I work on big datatable - over 50k rows so I understand the work with linq will be more efficient and fast than work with For Each and Assign
I try to be more clear, my datatable have over 50k rows and over 20 columns.
I’m looking for 2 queries
1.update new value for all rows in a specific column - for example update all the values in column number 4 (no matter what was the old value) to new value
2. query that update all the rows if specific column contain 2 different type of values (for example, if column number 3 contain “work” and “done” then replace it to"work done" - sometimes we receive in this column a symbol instead space like “work@done” or “work&done” so we looking for a query that correct those mistakes)
1.update new value for all rows in a specific column - for example update all the values in column number 4 (no matter what was the old value) to new value
You can play on provided xaml with following (Col 3 is updated with NewValue String)
(From d In dtData.AsEnumerable
Let ra= New Object(){d(0),d(1),“NewValue”}
Select dtResult.Rows.Add(ra)).CopyToDataTable
@noam
LINQ is about retrieval and updating is stressing the concept of LINQ
all update methods e.g. setField are subs, doesnt return a value and canot be used in LINQ within an assign
in some cases update statements can be written by using invoke code
Having this in mind is giving the reason why it is worked with constructing itemarray and add rows to the empty cloned datatable