I have a set of code that builds a table as the user enters information. This information may be changed more than once before it is considered complete. After the user is done, I want them to click a button, and have that information entered into the SQL database where it belongs. Right now, the code I am using gives the error:
"System.ArgumentException: This row already belongs to another table"

Is there a way to add a table to a table like this, or do I need to add each row to the SQL table as the user moves along.

Any help is much appreciated!

Try
            For Each row In Me.tblTraining
                Me.DataSet1.docContent.Rows.Add(row)
                Me.DocContentTableAdapter.Update(Me.DataSet1.docContent)
            Next
        Catch w As Exception
            MsgBox(w.ToString)
        End Try

First let me know Where u Fill The Value in parameter row and does it execute one time then gives error

Thank you very much for the quick response. I actually solved the problem after moving on to the next task.

The reason it would not add the row is because the KEY ID row in the new table matched one of the rows in the SQL table that already existed. I created a new SQL function that would get the highest identifying row number, added 1 (+1), and began inserting rows there. Works like a charm now.

Thanks anyway!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.