C# DataGirdView 填充10万条数据
DataGirdView 填充10万条数据,用以下方式基本耗时 2秒
DataTable dt = new DataTable();
DataColumn dc1 = new DataColumn("Column1");
DataColumn dc2 = new DataColumn("Column2");
DataColumn dc3 = new DataColumn("Column3");
dt.Columns.Add(dc1);
dt.Columns.Add(dc2);
dt.Columns.Add(dc3);
DataRow dr = null;
for (int i = 0; i < 100000; i++)
{
dr = dt.NewRow();
dr["Column1"] = i; dr["Column2"] = i + 1; dr["Column3"] = i + 2;
dt.Rows.Add(dr);
}
dataGridView1.DataSource = dt;