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?
Dt2=Dt1.AsEnumerable().Take(5).CopyToDataTable()
ppr
(Peter Preuss)
August 3, 2022, 7:54pm
3
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
ppr
(Peter Preuss)
August 3, 2022, 8:06pm
5
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
ppr
(Peter Preuss)
August 3, 2022, 8:15pm
8
ok then lets try following:
was this done?
Hi @lucas.mcgonagle
EDIT
20.10 fixed this issue for newly created projects.
You can fix it by adding the Assembly Reference manually in your xaml file:
[image]
Simply open the file in Notepad and create new line with this String:
<AssemblyReference>System.Data.DataSetExtensions</AssemblyReference>
Then reopen your project and the error should be gone.
Please be careful while doing so and always keep a backup.
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
ppr
(Peter Preuss)
August 4, 2022, 8:11am
10
sowmiya.anbalagan:
Now the error is gone
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
system
(system)
Closed
August 7, 2022, 8:11am
11
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.