loop through all the DataRows in an array of data rows to update rows in a table

Posted on 2009-02-19
Last Modified: 2012-05-06
I'm trying to update multiple rows in a table with a common value in a field called ReferralID as per the code below.  
Dim DocsRow() As Data.DataRow

DocsRow() = DsDocsRelDocs.Tables("DocsRelDocs").Select("ReferralID = " & ReferralID)

         For Each DataRow In DocsRow()

                    DocsRow("SortedRelDocs") = SortedRelDocs


Open in new window

Question by:FatalErr
    LVL 29

    Expert Comment

    by:David H.H.Lee
    Hi FatalErr,
    Try this:
    DocsRow.AcceptChanges()'add this

    For Each DataRow In DocsRow()
                        DocsRow("SortedRelDocs") = SortedRelDocs

    LVL 29

    Accepted Solution

    Hi FatalErr,
    Ignore the previous sample,try this instead.
    For Each DataRow1 As Data.DataRow In DocsRow
                    DataRow1("SortedRelDocs") = SortedRelDocs

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Normally the drop down box control found in the .Net framework tools is able to select just one data and value at a time, which is displayed on the text area.   But what if you want to have multiple values to be selected in the drop down box? As …
    It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now