How to updata a datarow in a DataTable

  • Thread starter Thread starter ad
  • Start date Start date
A

ad

I have a DataTable like

StID SchoolYear Score
----------------------------------
1 2003 95
1 2004 96
2 2005 97

I want to update the DataRow of (1,2004,96) to (1,2004,80)

How can I do?
 
1. Find proper row - you might do a foreach loop or use Select or something
similar
2. row["Score"] = 80;
 
Note: The Item property is the default property of a DataRow so:

[C#]

row["Score"] = 80;
and
row.item["Score"] = 80;

are the same thing and:

[VB.NET]

row("Score") = 80
row.Item("Score") = 80

are the same thing.

Miha Markic said:
1. Find proper row - you might do a foreach loop or use Select or
something similar
2. row["Score"] = 80;

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

ad said:
I have a DataTable like

StID SchoolYear Score
----------------------------------
1 2003 95
1 2004 96
2 2005 97

I want to update the DataRow of (1,2004,96) to (1,2004,80)

How can I do?
 
Back
Top