Datatable does not contain a defnition for 'AsEnumerable'

I am trying to use the below syntax to get the top 5 rows from datatable but it is throwing
Datatable does not contain a defnition for ‘AsEnumerable’

dt2=dt1.AsEnumerable().Take (5).CopyToDataTable()

I have also added System.Data.DataSetExtensions in the Main.xaml but still getting the same error.

Can anyone say how to resolve this error

Attached the error screenshot for reference

hi why is there a space next to take (5)?

Is this the logic you are using?


we do see the statement, that you try. But we dont see the statement which you have implemented.

Can you share with us.

Also ensure that the datatype of your datatable variable is of System.Data.DataTable

Just check this in the variable panel by hovering over the the type and getting displayed the full qualified datatype

we found fixes sometimes quicker when referring to the xaml. Is it possible that you can share your xaml with us.

On the first look it looks fine (statement and datatype)

1 Like

Agreed with Peter, Do share your xaml, else you can try to adda new data table variation and see if the error persists.

I am unable to share it… It’s in my client machine

ok then lets try following:

was this done?

Which Targetframework is selected for the project?
Which version of UiPath.System.Activities is in use?
Is System.Data added to the namespaces (imports, close to the variable panel)?

I have removed the assembly reference and added again. Now the error is gone. Thanks

Perfect. May we ask you to close the topic? Thanks
Forum FAQ - How to mark a post as a solution - News / Tutorials - UiPath Community Forum

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