Uppdate value in datatable when using select statement

Posted on 2012-08-20
Last Modified: 2012-08-20

How do I put the amount back into the datatable with a new value when I have done a select statement?

DataRow[]  foundRow = dtPrev.Select("memno = '" + memno + "'" )
   if (foundRows.Length > 0)
                for (int i = 0; i < foundRows.Length; i++)

 amt = Convert.ToDecimal("10.95")+ Convert.ToDecimal(foundRows[i]["amount"].ToString());

// Here I need to put the amount back into the datatable


Open in new window

Question by:elmbrook
    LVL 5

    Accepted Solution

    So you're just trying to update the value in the row to the previous value + $10.95?  You should be able to update the DataRow and then commit your changes.  Please post back if you're looking for something different?

    Author Closing Comment

    by:elmbrook a long night

    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.

    In one of my recent projects, I was working with IP cameras, I need to take some pictures from the camera and do some processing on it. The first step, was to retrieve the image from camera into Image object. So that it can be displayed or …
    Article by: Ivo
    C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
    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…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    760 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

    11 Experts available now in Live!

    Get 1:1 Help Now