Site Search:
Sign in | Join | Help
4Penny.net

ASP.NET

Notes, Tricks and Tips on ASP.NET Coding

October 2007 - Posts

  • How to delete a row in a datatable

    It took me too long to Google this - had to look on www.experts-exchange.com for it. (very nice site)

    [code language="vb.net"]

    Dim intRowID As Int64

            intRowID = e.CommandArgument
            ' Loop though the table

            Dim intCounter As Int16 = 0
            While intCounter < oDT.Rows.Count
                oRow = oDT.Rows(intCounter)
                If oRow("rowID") = intRowID Then
                    oRow.Delete()
                    intCounter = oDT.Rows.Count
                End If

                intCounter += 1
            End While

            oDT.AcceptChanges()

     

    [\code]