How to updata a datarow in a DataTable

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?
 
M

Miha Markic [MVP C#]

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

Scott M.

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top