Microsoft
Software
Hardware
Network
Question : Error: "DataTable already belongs to another DataSet."
I am trying to delete multiples rows from a DataTable that I load into a DataSet.
I am able to delete the first row fine. When I try to delete the secon row, I get the error:
"DataTable already belongs to another DataSet."
My code:
Dim DebtAnalyzerTable As DataTable
Dim DS2 As New DataSet()
'Retrieving Debt Table
DebtAnalyzerTable = Session.Item("DebtTableEdi
t")
' Add the new DataTable to the DataSet.
DS2.Tables.Add(DebtAnalyze
rTable) 'DebtAnalyzerTable.Copy
' Loop though the table and delete specified row
For Each drow As DataRow In DS2.Tables(0).Select()
If (drow("Creditor Name") = TextBoxCreditorName.Text) Then
drow.Delete()
End If
'DS2.Tables(0).AcceptChang
es()
Next
Session.Add("DebtTableEdit
", DebtAnalyzerTable)
'Binding Edited Row to Data Table
GridView1.DataSource = DS2
GridView1.DataBind()
Thanks,
Dan
Answer : Error: "DataTable already belongs to another DataSet."
Hmmm...I always create separate log file backups. Why don't you like this? The reason is that it lets me put a time stamp on them, and in the event I need to restore them, its easy to determine the order I need to restore them in.
Random Solutions
Is there a way to get rid of the faint scroll bar when there is not enough items in a ListBox?
Set which browser opens and responds to "mailto:" links
Windows 2003 SBS locks up during full scan of Malwarebytes.
How to Download all files using FTP from a VS 2008 VB project
Maximum HDD Temperature risk
Changing ownership per KB: 271071 Gets me the hour glass
Defining variables to display words based on coded values
Parental control for the internet
Automatic Open of Excel spreadsheet in Powerpoint
MySQL Query Error: Column count doesn't match value count at row 1