将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]);


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3