Uipath add data row input array is longer than the number of columns in this table

Hi I am getting issue add data row input array is longer than the number of columns in this table.
In my code even I just pass single static value still got this issue.In my data table I used default value new System.Data.DataTable

share screen shot of Processā€¦
If you use Build Data tableā€¦check no. of column in Data table and Compare this to add data row nameā€¦

1 Like

Hy!!

Could you share your process with us?

1 Like

issue resolved thanks for help

could you please share how you resolved the issue even i am facing the same error

thanks in advance

This issue happens because your data row has more columns than your datatable.

Once you initialize a datatable by using new System.Data.Datatable command, add as many data columns (using the Add Data Column activity) as the columns in your Add Data Row input array.

how to slove this

how to solve this Add Data Row: Input array is longer than the number of columns in this table.

Letā€™s say you have a datatable (DT) with the columns {Name, Age, Gender}

To this datatable, if you add a datarow with the following columns {Name, Age, Gender, Location}, you will encounter the error mentioned above.

To solve this, you need to add the Location column to DT using the Add Data Column activity.

I managed to solve the issue by not initiating the data table (new System.Data.DataTable). Just built data table with the correct columns and and used add row activity with the same columns.