Updating a dataset in memory

Posted on 2006-04-03
Last Modified: 2010-04-23

I am loading a large amount of data into a datset and I want to update varuious rows from time to time and select particular rows back

I understand but haven't doe it yet that i can select vaious rows back with dataset.Select but is there a way to update them.

So maybe

Dataset.Update - Set Selected = True where Value1 = 7 (Where Selected = true)

Question by:gringogordo
    LVL 6

    Accepted Solution


    Firstly in the select statement you setup your SQL selection but without the "WHERE" bit and you select on the table within the dataset

    say your table is called Customer you will therefore have a CustomerRow object as well...

    dim sql as string = "CreditLimit > 10"
    dim rowsFound() as datarow
    dim dr as datarow

    rowsFound =
    if rowsFound.Length = 0 Then
        row = dataset.Customer.NewCustomerRow
        row.Name = "XYZ Customers"
        row.CreditLimit = 100
       for each dr in rowsFound
           dr.CreditLimit = dr.CreditLimit * 2

    HTH :)

    Author Comment

    Thanks for that.  Its pretty much what I was looking for although I was hoping not to have to loop round.  Although I accept that as you are only looping around the necessary rows this is probably what any under the hood solution would be doing anyway (were it to exist).

    I'll assign the points after lunch!

    LVL 6

    Expert Comment

    Yeah  it's not the nicest bit of code but we have never found any speed issues with this and then the ease of coding when we finally post back to the database via the dataAdapter.update, e.g. to keep everything in a transaction more than makes up for it!


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Suggested Solutions

    I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    759 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

    8 Experts available now in Live!

    Get 1:1 Help Now