Question data row already belongs to this table?

Pedro

Member
Joined
Nov 7, 2009
Messages
5
Programming Experience
Beginner
Hello, does anyone know why i have an error " This row already belongs to this table"? I want to add a few rows to a table but..
I've created the table:

VB.NET:
Dim dtList As New DataTable

        With dtList
            .Columns.Add("Pk")
            .Columns.Add("M")
            .Columns.Add("P")
            .Columns.Add("Z")
            .Columns.Add("Rumo")
        End With

        ObraDataSet.Tables.Add(dtList)

I've created the row:

VB.NET:
 Dim drCurrListagem As DataRow = dtList.NewRow

after some calculations,

VB.NET:
drCurrListagem("Pk") = Pkcurr
                            drCurrListagem("M") = X
                            drCurrListagem("P") = y
                            drCurrListagem("Rumo") = Rumo


                            dtList.Rows.Add(drCurrListagem)

What's wrong??

thanks for your help, i can't figure it out...
 
Either youre adding a row with a PK that already exists, or the row youre adding has already been added. Post the full code please, not just snippets of it
 
Back
Top