DataGridView 显示数据性能问题
从acess中读取数据然后显示到一个表格中
public void ShowWorkContentGrid(string dirCode, DataGridView gridView)
{
string sqlForSel = "select ID,Name from WorkContent where ItemCode='" + dirCode+"'";
OleDbCommand cmd = new OleDbCommand(sqlForSel, conn);
OleDbDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
DataGridViewRow row = new DataGridViewRow();
DataGridViewCell Cell1 = new DataGridViewTextBoxCell();
Cell1.Value = reader[0];
row.Cells.Add(Cell1);
Cell1 = new DataGridViewTextBoxCell();
Cell1.Value = reader[1];
row.Cells.Add(Cell1);
gridView.Rows.Add(row);
}
reader.Close();
}
这么做 如果数据的条目量很多很多的话,表格显示的速度很慢
特别是频繁调用显示 就和死掉了一样
有什么好的方法不?