Advertisement

07.23.2008 at 09:29AM PDT, ID: 23589134
[x]
Attachment Details

problem deleting datarow in datatable

Asked by NevSoFly in Microsoft Visual Basic.Net

Tags: VB.NET, 2005

I am using the attached code to remove datarows from on datatable that match datarows in another datatable.  The problem is that the row count for that datatable doesn't change and once the last datarow that I need to be deleted has been processed I get the following error.

DeletedRowInaccessibleException was unhandled.
Deleted row information cannot be accessed through the row.

I can't view the datatable using the data table visualizer because this causes an error in VS:

Unhandled exception
Deleted row information cannot be accessed through the row.




Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
If dtTemp.Rows.Count > 0 And dtAssembly.Rows.Count > 0 Then
            For Each drclient As DataRow In dtAssembly.Rows
                For Each drServer As DataRow In dtTemp.Rows
                    If drclient("ASSEMBLY_NUMBER") = drServer("ASSEMBLY_NUMBER") Then drclient.Delete()
                Next drServer
                If dtTemp.Rows.Count = 0 Then Exit For
            Next drclient
        End If
[+][-]07.23.2008 at 10:14AM PDT, ID: 22071478

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 10:48AM PDT, ID: 22071890

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.23.2008 at 10:54AM PDT, ID: 22071945

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Visual Basic.Net
Tags: VB.NET, 2005
Sign Up Now!
Solution Provided By: MijaeDjinn
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628