将DataTable中的一行复制到另一个DataTable的方法

网络编程 发布日期:2026/1/18 浏览次数:1

正在浏览:将DataTable中的一行复制到另一个DataTable的方法
将DataTable中的一行复制到另一个DataTable

方法1:

        DataRow dr = ds2.Tables[0].NewRow();
        dr.ItemArray = ds1.Tables[0].Rows[i].ItemArray;
        ds2.Tables[0].Rows.Add( dr ); 

方法2:

     ds2.Tables[0].ImportRow(ds1.Tables[0].Rows[i]);