Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Uppdate value in datatable when using select statement

Posted on 2012-08-20
2
Medium Priority
?
339 Views
Last Modified: 2012-08-20
Hi

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

0
Comment
Question by:elmbrook
2 Comments
 
LVL 5

Accepted Solution

by:
kevinhigg earned 2000 total points
ID: 38314454
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?

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

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

Author Closing Comment

by:elmbrook
ID: 38314816
duhh...my bad...lol...was a long night
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

572 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