Hi all, i’m trying to get the length of one column to another new column using Linq can you please help me
dtWithLength = (From row In dt.AsEnumerable()
Let length = row.Field(Of String)(“TextColumn”).Length
Select dt.Clone().Rows.Add(row.ItemArray.Append(length).ToArray())).CopyToDataTable()
hi i want to add the length value to column3 of the same datatable
Hi @Amrutha.mg ,
Could you explain a bit more as to what is required maybe with an Example so that we can be clear on the requirement.
consider a datatable with 3 columns we have to take the length of column 1 value and update it to column 3
Maybe check with the below method using Data Column Expression as it is a Simple operation :
DT.columns("Length").Expression = "Len([Text])"
Implementation :
Debug Visuals :
Do also check the links below :
Thank you for your help
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.