开发者

add a row to a datatable from a row in a different datatable

i am currently doing this:

    for (int i = 开发者_C百科0; i < 15; i++)
    {
        dt_final.Rows.Add(dt.Rows[i]);
    }

but i am getting an error that this row belongs to another table. how do i import this row to dt_final table?


you can only add rows that where created from the DataTable (ie throug NewRow). But you can import a row from a different table

 dt_final.ImportRow(dt.Rows[i]);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜