Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Deleting a row
Message
De
02/01/2011 19:00:34
 
 
À
02/01/2011 18:46:32
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01494343
Message ID:
01494355
Vues:
38
>What code are you using that you get this error? A DataRow can call it's Delete() method with no problem. Are you doing something peculiar?

I always have to do something like this:
            loDataView = New DataView(loDataProvider.oDataSet.Tables.Item(0))

            loDataView.RowFilter = "Flag=1"

            ' Delete all records which have been flagged
            For Each loRowView In loDataView
                loRowView.Delete()
            Next

            loDataView.RowFilter = ""
            loDataView.Table.AcceptChanges()

            ' Adjust the count
            loDataProvider.nCount = loDataProvider.oDataSet.Tables("Temp").Rows.Count
Because, if I scan my dataset, and based on a condition, I want to remove the record, it will tell me that the Delete() method cannot be used:
            ' For each message
            For lnCounter = 0 To loDataProvider.nCount - 1
                loRow = loDataProvider.oDataSet.Tables("Temp").Rows(lnCounter)

                ' If we have to delete the row
                If True Then
                    loRow.Delete()
                End If

            Next
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform