When I run the following code:
I get the following error on the line in red text:
How, please, do I remedy this?
Thanks!
Dot
Code:
Friend Function FillUsersPropertiesFromDataset(ByVal ds As DataSet) As UserAccountManagerDLL.User()
If ds.Tables.Count <> 1 Then Exit Function
If ds.Tables(0).Columns.Contains("PropertyName") = False Then Exit Function
If ds.Tables(0).Columns.Contains("PropertyValue") = False Then Exit Function
Dim arrUsers(0) As UserAccountManagerDLL.User
Dim oUser As UserAccountManagerDLL.User
Dim oRow As DataRow
Dim CurrentUserIdentifier As Integer = 0
Dim dsTemp As New DataSet
Dim dtTemp As New DataTable
dsTemp.Tables.Add(dtTemp)
For Each oRow In ds.Tables(0).Rows
If CurrentUserIdentifier <> oRow("ClassInstanceIdentifier").ToString And CurrentUserIdentifier <> 0 Then
CreateUserObjectAndInsertIntoUsersArray(ds, oRow, dsTemp, arrUsers)
End If
[b][COLOR=red]dsTemp.Tables(0).Rows.Add(oRow)[/color][/b]
CurrentUserIdentifier = oRow("ClassInstanceIdentifier")
Next
CreateUserObjectAndInsertIntoUsersArray(ds, oRow, dsTemp, arrUsers)
Return arrUsers
End Function
I get the following error on the line in red text:
[tt]An unhandled exception of type 'System.ArgumentException' occurred in system.data.dll
Additional information: This row already belongs to another table.[/tt]
How, please, do I remedy this?
Thanks!
Dot