DataRow复制一行到另一个DataTable
DataRow复制一行到另一个DataTable
下面两个方法是DataRow复制一行到另一个DataTable的,直接Add会出错“此行已属于另一个表”,其实以前就知道怎么做的,可每次要用到的时候还是犯糊涂,这次把它们记下来。   
1.用DataRow.ItemArray    
DataTable t=new DataTable();    
DataRow r=t.NewRow();    
r.ItemArray=oldRow.ItemArray;    
t.Rows.Add(r);    
2.用DataTable.ImportRow()    
t.ImportRow(oldRow);
                    
                
                
            
        
浙公网安备 33010602011771号