DataGridViewRow转换为DataRow

编辑器加载中...

            DataTable dt  = I_IDOM_DyIntQuery.QueryDyInt(SelectedInfo());
            dgvDynQuery.DataSource = dt;
            DataTable dd = new DataTable();
            dd = dt.Clone();//赋值结构
            foreach (DataGridViewRow dgvr in dgvDynQuery.Rows)
            {
                DataRow dr = dd.NewRow();
                dr = (dgvr.DataBoundItem as DataRowView).Row;//微软提供的唯一的转换DataRow
                dd.Rows.Add(dr.ItemArray);//此处不可是直接dr否则会报错
            }

 

你可能感兴趣的:(datagridview)