Link to home
Start Free TrialLog in
Avatar of FatalErr
FatalErr

asked on

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

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
         Next

Open in new window

Avatar of David H.H.Lee
David H.H.Lee
Flag of Malaysia image

Hi FatalErr,
Try this:
DocsRow.AcceptChanges()'add this

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

http://msdn.microsoft.com/en-us/library/system.data.datarow.acceptchanges.aspx

       
ASKER CERTIFIED SOLUTION
Avatar of David H.H.Lee
David H.H.Lee
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial