Add row to Datatable RRS feed

  • Question

  • I have declared a datatable globaly in a application, and i assigned the datatable to the new datatable declared in the function. when i add a row or delete a row in the datatable declared in the function, it affects the both the datatable local table inside the function and global table in the class.

    How to fix this issue.



    Tuesday, September 25, 2012 3:47 PM


  • You need to pass the copy of the global data table to the function; otherwise function will modify the same instance of data table where global data table is referencing.

    You can use Copy method to create copy from global data table and pass it to the function, then function will work with the copy not the global data table.

    • Proposed as answer by Mike Feng Wednesday, September 26, 2012 11:34 AM
    • Marked as answer by Mike Feng Monday, October 8, 2012 11:37 AM
    Tuesday, September 25, 2012 5:23 PM