【发布时间】:2012-04-16 09:45:25
【问题描述】:
我想将数据行过滤器值插入数据表,但它返回以下错误“此行已属于另一个表。”请帮我解决这个错误..
这是我的部分代码:
for (int j = 0; j < ListBox1.Items.Count; j++)
{
DataView DV = new DataView();
DV = DS1.DefaultView;
DV.RowFilter = "fldemployee='" + ListBox1.Items[j].Text + "' and fldassigndate = '04-07-2012'";
if (DV.Count > 0)
{
DataTable table = DV.ToTable("sp_getallattendancesetup");
DataRow row = table.Rows[0];
DT.Rows.Add(row);
}
}
GridView1.DataSource = DT;
GridView1.DataBind();
【问题讨论】: