数据行未添加到数据表中 [英] datarow not adding to the a datatable
本文介绍了数据行未添加到数据表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用VS2008;
问题是我无法将行从一个数据表导入到另一个数据表.您能建议其他安全方法吗?快速回答将不胜感激.
问候.
I am using VS2008;
The problem is that i am not been able to import the rows from one datatable to another. Can you suggest any other safe way ? Quick answer will be highly appreciated.
Regards.
foreach (DataRow dc1 in Project_Group_qf_or_qg.Rows)
{
dtfinal.ImportRow(dc1);
}
推荐答案
尝试以下....
Hi,
try the following....
foreach (DataRow dc1 in Project_Group_qf_or_qg.Rows)
{
dtfinal.Rows.Add(dc1);
}.
或者如果您想在指定位置添加一行
or if you want to add a row at specified position
foreach (DataRow dc1 in Project_Group_qf_or_qg.Rows)
{
dtfinal.dsEmployee.Tables[0].Rows.InsertAt(dc1,inserting position);
}.
希望这对您有帮助
Hope this helps
您可以使用
dtfinal = Project_Group_qf_or_qg.Copy()
You Can Use
dtfinal=Project_Group_qf_or_qg.Copy()
foreach (DataRow dc1 in Project_Group_qf_or_qg.Rows)
{
dtfinal.Rows.Add(dc1);
dtfinal.AcceptChanges();
}
一旦您向数据行添加了一些值,数据表就应该接受更改....
试试上面的代码
Once u added some values to the datarow,the data table should acept the changes....
try the above codes
这篇关于数据行未添加到数据表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文