|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to remove a row of a Datarow()-ArrayHello !
I have a Datarow()-Array ! Dim dvAuf As DataRow() dvAuf = dtAuftrag.Select("artnr = 'xyz'") while dvAuf.GetUpperBound(0) > 0 dvauf().delete end while Is it possible to delete a certain row of the Array ? Thanks aaapaul Paul,
Be aware of the difference between a remove and a delete in AdoNet. A remove, does remove a row direct while a delete removes it after an update or an acceptchanges (if there is not a constraint involved) (Except when the row was new added than a delete is the same as a remove). As well know that both operations are extremely slow in version 2002/2003. (If you know in those versions that what stays is less than that was goes, it is faster to import everything in a new table) And as last, try from removing from a collection to do it bottom up. Just typed in this message so watch typos. \\\ dim drcAuf as datarowcollection = dtAuftrag.Select("artnr = 'xyz'") for i as integer = drcAuf.count-1 to 0 step -1 drcAuf.RemoveAt(i) next /// If you want to use the delete than you have to do it using the datarow itself. \\\ dim drcAuf as datarowcollection = dtAuftrag.Select("artnr = 'xyz'") for i as integer = drcAuf.count-1 to 0 step -1 dim dr as datarow = drcAuf(i) dr.delete next /// I hope this helps, Cor |
|||||||||||||||||||||||