//1.this.dataGridView1.DataSource = null;//会将DataGridView的列也删掉
//2.this.dataGridView1.Columns.Clear(); //异常
//3.重新绑定之前的DataTable,然后清除DataTable中的数据完美解决
DataTable dt = (DataTable)dataGridView1.DataSource;
dt.Rows.Clear();
dataGridView1.DataSource = dt;