Reputation: 611
I have a question about the datarow and how I can update it...
I have a datatable with two columns, id and name. I do the following:
// data table has data at this point....
myTable.Columns.Add("Fri");
foreach(DataRow r in myTable.Rows) {
r["Fri"] = 4;
}
What I am trying to do here is add a new columnm, "Fri". Then for each entry already in the data table I want to have the value in column Fri as 4. Thanks for the help.
Upvotes: 0
Views: 907
Reputation: 2044
The code you listed should work, but if you want to later use the Fri value as an integer you should declare the data type of the column like this:
myTable.Columns.Add("Fri", typeof(int));
Upvotes: 1