Filter a column using SELECT Function

excel
activities

#1

Hello,

                  I am trying to filter a column "Deal Type" this is equal to "GG". I am using "data1 = data.Select("[Deal Type]"  = GG").CopyToDataTable where data is my datatable. But I am getting an error saying that "cannot find column name GG". GG is not a column but the string I am trying to compare. Please help me. 

Thank you


#2

Do you have too many quotes? “[Deal Type] = GG”
or maybe “[Deal Type] = ‘GG’”

To be honest, I find using lambda with .Where easier to understand

data.AsEnumerable.Where(Function(r) r("Deal Type").Trim = "GG" ).CopyToDataTable

Hope that helps.

Regards.


#3

Thank you