Unable to Get data row value from collection of object

Execute the power-shell script and got the output as collection of Object.While looping that object got the multiple data row, but unable to extract the value from that data rows.


@TharmaKS Change TypeArgument from object to DataRow and check

If I change the the TypeArgument as DataRow the below exception will occur,

Throw : Unable to cast object of type ‘System.String’ to type 'System.Data.DataRow


@TharmaKS change it to System.Data.DataRow

Yes, I gave System.Data.DataRow as type argument and checked the above exception only occurred.

@TharmaKS Ur printing datarow directly which is not possible print values column by column in that row.

displaying 1st column in that row 2nd column value
item(0).ToString item(1).ToString
or or

item(0)(0).ToString item(0)(1).ToString

let me know if it works or not.

I have tried the Validation error occurs,


@TharmaKS post what error validation ur getting. What is the datatype of variable tt is?

Variable: tt, Data type :collection of Object
Please refer the below image,

@TharmaKS try something like below.

Tried but same error.

@TharmaKS Give type arguement as System.Data.datarow and in writeline item(0).ToString, If ur getting tt as array datarow it will work. Other wise there will be problem in tt variable value.