dgvCategoryStat.SelectedRows 后转 DataTable

简介:             if (dgvData.SelectedRows.Count > 0)            {                DataTable orgData = (DataTable)this.
             if  (dgvData.SelectedRows.Count  >   0 )
            {
                DataTable orgData 
=  (DataTable) this .dgvData.DataSource;
                DataTable newData 
=  orgData.Clone();
                
for  ( int  r  =   0 ; r  <  dgvData.SelectedRows.Count; r ++ )
                {
                    DataGridViewRow selectedRow 
=   this .dgvData.SelectedRows[r];
                    DataRow copyRow 
=  newData.NewRow();
                    
for  ( int  j  =   0 ; j  <   this .dgvData.Columns.Count; j ++ )
                    {
                        copyRow[j] 
=  selectedRow.Cells[j].Value;
                    }
                    newData.Rows.Add(copyRow);
                }
            }
目录
相关文章
|
数据库
dataTable转list
dataTable转list
116 0