Linq error

Hi guys,

I am not good in linq , so below is my try for distinct records , please correct me.

dtResult.AsEnumerable.GroupBy(Function(x) new with {Key.a=x(“Customer Account”).ToString,Key.b=x(“Company Code”).ToString,Key.c=x(“Frequency”).ToString,Key.d=x(“Start Date”).ToString,Key.e=x(“End Date”).ToString,Key.f=x(“Email contact”).ToString} into grp=Group Select grp.First()).CopyToDatatable()

I am getting error as ,

1 Like

@amruta_pawar Try this query :
dtResult.AsEnumerable.GroupBy(Function(x) new with {Key.a=x(“Customer Account”).ToString,Key.b=x(“Company Code”).ToString,Key.c=x(“Frequency”).ToString,Key.d=x(“Start Date”).ToString,Key.e=x(“End Date”).ToString,Key.f=x(“Email contact”).ToString}).Select(Function(g)g.First).CopyToDatatable

2 Likes

Thank you so much it worked

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.