?
Solved

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

Posted on 2009-02-19
2
Medium Priority
?
856 Views
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
         Next

Open in new window

0
Comment
Question by:FatalErr
  • 2
2 Comments
 
LVL 29

Expert Comment

by:David H.H.Lee
ID: 23688905
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

       
0
 
LVL 29

Accepted Solution

by:
David H.H.Lee earned 2000 total points
ID: 23688921
Hi FatalErr,
Ignore the previous sample,try this instead.
 
For Each DataRow1 As Data.DataRow In DocsRow
                DataRow1.AcceptChanges()
                DataRow1("SortedRelDocs") = SortedRelDocs
Next
0

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month13 days, 22 hours left to enroll

809 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