Class 'System.Data.Datatable' cannot be indexed error

Hi experts

I am automating a process that uses a DataTable and DataRow variable. In my workflow I am assigning the DataRow by using the assign activity:

myDataRow = myDataTable(rowCounter)

But I getting the following validation error:

“Class ‘System.Data.DataTable’ cannot be indexed because it has no default property.”

Which default property is the error referring to?

1 Like

You forgot the .Rows

myDataRow = myDataTable.Rows(rowCounter)

4 Likes

Thanks Karthik

I can see that the validation error is resolved. However I am wondering why that error is not occuring in another process where the .Rows is left out (?)

It might be array of data rows not data table.
or the assign activity is used in a loop (so no need to use .Rows)

Always make sure the syntax you’re using is correct. As mentioned by @KarthikByggari it must have been an ARRAY of data rows instead of a DATATABLE which is an OBJECT of System.Data.Datatable class.

An array of data rows can be indexed, not a datatable object. However, a datatable would have Rows() as one of its properties which is a collection of Datarow objects, and hence can be indexed.


system.data.datatable cannot be indexed

1 Like

Please any help to resolve above issue

Use: customerData.Rows(RowNumber)(‘firstname’).tostring

4 Likes

Thank you Now its working

I am thankful for the solution as well. as i was also getting same error.

i just have one query. why we have received this error and how .Rows rectify that.

thank you

this works fine. thanks for the guidance

thanks… now it’s working for me