DataTable tt = new DataTable();
for (int i = 0; i < dgvEdit.Columns.Count;i++ )
{
tt.Columns.Add(dgvEdit.Columns[i].HeaderText);//创建一个与datagridview一样列名的datatable
}
if (!dgvEdit.CurrentRow.IsNewRow)
{
int count = dgvEdit.SelectedRows.Count;//选中行的个数
for (int i = count - 1; i >= 0; i--)
{
string strId = "";
tt.Rows.add(dgvEdig.SelectedRows[i]);
}