cancel
Showing results for 
Search instead for 
Did you mean: 

Issue in Code Stage using DataTable as Variable

MohiniShelke
Level 4
Hi Team,

I am using c# linq query of group in Code Stage,

But, I am getting following error.

Description: Compiler error at line 1: 'System.Data.DataTable' does not contain a definition for 'AsEnumerable' and no extension method 'AsEnumerable' accepting a first argument of type 'System.Data.DataTable' could be found (are you missing a using directive or an assembly reference?)
Repairable: No

Please let me know the solution for this?

Thanks in advance




------------------------------
Mohini Shelke
RPA Developer
vElement It
------------------------------
6 REPLIES 6

david.l.morris
Level 14
You're missing a namespace. I think that specific error is if you're missing the generic collections namespace. Can't remember.

Try making sure you have these at least:

External References:
  • System.dll
  • System.Data.dll
  • System.Xml.dll
  • System.Drawing.dll
  • System.Core.dll
  • System.Data.DataSetExtensions.dll
Namespace Imports:
  • System
  • System.Drawing
  • System.Data
  • System.Collections.Generic
  • System.Linq
Edit: One or two of those may be unnecessary depending on what you're doing with it, but it won't hurt to add them all.


------------------------------
Dave Morris
3Ci @ Southern Company
Atlanta, GA
------------------------------
Dave Morris 3Ci at Southern Company Atlanta, GA

Thank David Morris

It works fine but another error occurs  as follws:

Description: Compiler error at line 0: The out parameter 'ColumnValues' must be assigned to before control leaves the current method
Repairable: No
My Code :

var grouped = from table in InputCollection.AsEnumerable()var grouped = from table in InputCollection.AsEnumerable()group table by new {  placeCol = table["Place"] 
} into groupby select new{Value = groupby.Key,ColumnValues = groupby,};



Thanks

------------------------------
Mohini Shelke
RPA Developer
vElement It
------------------------------

Set a default value for variable ColumnValues

------------------------------
Gopal Bhaire
Analyst
Accenture
------------------------------

Hi can you tell me how to define default value to variable ColumnValues ?


I tried ,but not working.


I have already shared the code


Thanks in advance.



Thanks & Regards,

Mohini Shelke

RPA Developer, vElement IT,

Cell : (+91)9503221751

https://velement.io/


25620.gif


------Original Message------

Set a default value for variable ColumnValues

------------------------------
Gopal Bhaire
Analyst
Accenture
------------------------------

What is datatype of ColumnValues?

if it's collection set this at beginning ColumnValues=new System.Data.DataTable();
if it's text set this at beginning ColumnValues=String.Empty;



------------------------------
Gopal Bhaire
Analyst
Accenture
------------------------------


Thanks!

Working fine 



Thanks & Regards,

Mohini Shelke

RPA Developer, vElement IT,

Cell : (+91)9503221751

https://velement.io/


25629.gif


------Original Message------

What is datatype of ColumnValues?

if it's collection set this at beginning ColumnValues=new System.Data.DataTable();
if it's text set this at beginning ColumnValues=String.Empty;



------------------------------
Gopal Bhaire
Analyst
Accenture
------------------------------