我有一个从数据库填充的 DataTable,我试图在每行之后再添加 3 行。下面是代码。但在第 6 行我得到
引发了“System.OutOfMemoryException”类型的异常。
for (int i = 0; i < AlldaysList.Rows.Count; i++)
{
DataRow row;
row = AlldaysList.NewRow();
DataRow row1;
row1 = AlldaysList.NewRow();
DataRow row2;
row2 = AlldaysList.NewRow();
// Then add the new row to the collection.
row["scenarionid"] = DBNull.Value;
row["description"] = "";
row1["scenarionid"] = DBNull.Value;
row1["description"] = "";
row2["scenarionid"] = DBNull.Value;
row2["description"] = "";
AlldaysList.Rows.InsertAt(row, i + 1);
AlldaysList.Rows.InsertAt(row1, i + 2);
AlldaysList.Rows.InsertAt(row2, i + 3);
i++;
}