How to convert Object to datatable

I have Object which would have one are more value,I would like to convert this object into a table and save it to a csv/excel sheet and use join function below using assign to a string varilable.

string.Join(“‘,’”,Table1.AsEnumerable().[Select](Function(s) s.Field(Of String)(“Username”)).ToArray())

Can some once please help me with this on how to convert an object into a table and save it to a save ?

Hi @syed_Basha,

I think you can use the below code

dt=dt.DefaultView.ToTable(false,"Username")

Regards,
Arivu

I think you have misunderstood i am facing issue to convert an object to a table so i can utilize above code highlighted by me.

So is there any way i can use joins for an Object ?

@arivu96 I think you have misunderstood i am facing issue to convert an object to a table so i can utilize above code highlighted by me.

So is there any way i can use joins for an Object ?

Hello @syed_Basha,

Sorry bro, no time to make any workflow on this,
could you please go through below link?

Thanks,
Pankaj

@syed_Basha
Is your object is Ienumerable < DataRows >

If its IEnumerable of DataRows then we can convert to DataTable

Regards,
Mahesh

I guys i figured it out steps below.

assign “Object to a string vairable”
Build a datatable with no rows
Add row to that data from the above string variable.
and write to CSV file.

1 Like