Hello Everyone
I am here cause i would like to delete a specifics columns in a DataTable with a linq .
So far i found this linq in the forum but doesnt work
Yourdatatablename = Yourdatatablename.DefaultView.ToTable(False,”columnname1”, “columnname2”, “columnname3”).copytodatatable()
Give this syntax. This should solve your error.
Yourdatatablename = Yourdatatablename.DefaultView.ToTable(False,"columnname1", "columnname2", "columnname3")
Yourdatatablename
DataType → System.Data.DataTable()
Regards
The issue of sintax was solved but the problem is that the linq is bringme only that columns and that i need its deleted that 3 columns not only keep that 3 Columns
it is a method and not a LINQ where the more adequate syntax is about:
Yourdatatablename =
Yourdatatablename.DefaultView.ToTable(False,{"columnname1", "columnname2", "columnname3"})
But we keep in mind that it removes all other columns
just share with us the input and expected output sample
The above syntax indicates that
→ YourDataTable
is your DataTable variable.
→ False
indicates that you don’t want distinct rows; you just want to remove columns.
→ "columnname1"
, "columnname2"
, and "columnname3"
are the names of the columns you want to keep in the resulting DataTable.
Try this way instead:
ColumnNamestoRemove = {"ColumnName1","ColumnName2","ColumnName3"}
ColumnNamestoRemove
is of DataType Array(System.String)
For Each currentText in ColumnNamestoRemove
Remove Data Column Activity
-> Column Name -> currentText
-> From Data Table -> yourdatatablevariable
End For Each
Regards
Thank you so much for your explanation, i know how to do it with that activities its just like i would like to do it only in an assign activity but if is the only way, i will do
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.