Can't add DataRow to DataTable
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: Can't add DataRow to DataTable

  1. #1
    Join Date
    Nov 2011

    Can't add DataRow to DataTable


    I'm having trouble adding a DataRow to a DataTable.

    I create the DataRow like so:

    DataRow row = myDataTable.NewRow();

    I add things to the row, then I try to add the row back to the table:


    It tells me: "This row already belongs to this table."

    Ironically, if I try:


    it tells me: "Cannot perform this operation on a row not in the table."

    so is it in the table or is it not?

    myDataTable.AcceptChanges() seems to run without any exceptions, but my table is still empty.

    What gives?

  2. #2
    Join Date
    May 2002

    Re: Can't add DataRow to DataTable

    Please share the code that updates the columns within the row with data.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a survey!

HTML5 Development Center