DataGridViewRow row = new DataGridViewRow(); //新建一个DataGridViewRow
foreach (DataGridViewColumn c in dataGridView1.Columns)
{
row.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);//给行添加单元格
}
row.Cells[0].Value = reader.GetString(0); //给DataGridViewRow添加数据
row.Cells[1].Value = reader.GetString(1); //给DataGridViewRow添加数据
row.Cells[2].Value = reader.GetString(2); //给DataGridViewRow添加数据
dataGridView1.Rows.Add(row); //添加进DataGridView
将数据放在DataTable中,然后再绑定