Hello I have a dataTable updatedValues, and I was wondering if there was a way to set a value of the column with a value.
int rowindex = 0;
foreach(string val in something)
{
try
{
updatedValues.Columns["Books"][rowindex] = val;
Console.WriteLine("Went Here");
}
catch
{
}
rowindex++;
}
The try obviously won't compile because it has incorrect syntax, but I was wondering if there was anything similar to what is in the try.
Your question is confusing but I will take a stab at a response.
DataTables are matrices, similar to Excel, so to reference a specific value you would access it with something like this code:
var myVal = dataTable.Rows[row][column]; //To get a value
or
var x = 1;
var y = 3;
dataTable.Rows[x][y] = myVal; //To set a value
And as Umphishrey's McGee posted just before me you can iterate over the values.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments