C#的winForm中,DataRowView可以Add一个column吗?

来源:百度知道 编辑:UC知道 时间:2024/06/03 11:15:55

看看这个你就明白了:
private static void DemonstrateRowVersion()
{
// Create a DataTable with one column.
DataTable table = new DataTable("Table");
DataColumn column = new DataColumn("Column");
table.Columns.Add(column);

// Add ten rows.
DataRow row;
for (int i = 0; i < 10; i++)
{
row = table.NewRow();
row["Column"] = "item " + i;
table.Rows.Add(row);
}

table.AcceptChanges();
// Create a DataView with the table.
DataView view = new DataView(table);

// Change one row's value:
table.Rows[1]["Column"] = "Hello";

// Add one row:
row = table.NewRow();
row["Column"] = "World";
table.Rows.Add(row);

// Set the RowStateFilter to display only added
// and modifi