I have created a form which contains a dataset with two tables. I am attempting to add rows to one table however I receive an erros when doing so. Here is the code for the particular subroutine....
Private Sub btnCreateButtonRecords_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreateButtonRecords.Click
Dim x As Integer
Dim NewButtonRecord As DataRow = objdstButtonManagement.Button_Assignment_Table.NewRow
assign 99 button records to the template
For x = 1 To 99
NewButtonRecord(0) = x
objdstButtonManagement.Button_Assignment_Table.Rows.Add(NewButtonRecord)
Next
End Sub
The error I receive is:
An unhandled exception of type System.ArgumentException occurred in system.data.dll
Additional information: This row already belongs to this table.
It should be noted that the table already has records (rows) in the table and duplicates are allowed on the key field (column)
Any suggestions?
Private Sub btnCreateButtonRecords_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreateButtonRecords.Click
Dim x As Integer
Dim NewButtonRecord As DataRow = objdstButtonManagement.Button_Assignment_Table.NewRow
assign 99 button records to the template
For x = 1 To 99
NewButtonRecord(0) = x
objdstButtonManagement.Button_Assignment_Table.Rows.Add(NewButtonRecord)
Next
End Sub
The error I receive is:
An unhandled exception of type System.ArgumentException occurred in system.data.dll
Additional information: This row already belongs to this table.
It should be noted that the table already has records (rows) in the table and duplicates are allowed on the key field (column)
Any suggestions?