我有一个数据表(表),其中有一个名为Col1的列,我想创建列Col2。我想从Col2 [cell“ 2”]和Col1 [cell“ 3”]]的总和中获取Col2 [cell“ 1”]的值
我正在使用以下代码:
DataColumn Col2 = new DataColumn();
Col2.DataType = System.Type.GetType("System.Decimal");
Col2.ColumnName = "Col2";
table.Columns.Add(Col2);
DataRow row;
for(int i = 1; i < table.Rows.Count; i++)
{
row = table.NewRow();
row["Col2"] = row["Col2",(i-1)] + row["col1"]
table.Rows.Add(row);
}
我有一个数据表(表),其中有一个名为Col1的列,我想创建列Col2。我想从Col2 [cell“ 2”]和Col1 [cell“ 3”]的总和中获得Col2 [cell“ 1”]的值,就像...