QuestionQ172

VerifiedVariables and Arguments

A developer used the Add Data Row activity to add a row to a data table named dt_Reports. At runtime, UiPath Studio throws the exception Add Data Row: Object reference not set to an instance of an object. because the data table was not initialized.

To resolve the issue, what should the developer add in an Assign activity before the Add Data Row activity?

Explanation

dt_Reports must reference an instantiated System.Data.DataTable before Add Data Row can add a row to it. Assigning New System.Data.DataTable to dt_Reports creates the required table object. UiPath’s documented example initializes a DataTable variable with new DataTable before using Add Data Row.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!