0
我想插入數據行過濾器值到datatable,但它返回以下錯誤「此行已屬於另一個表」。請幫我解決這個錯誤..datarow過濾器值到數據表
這是我的部分代碼:
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();
http://stackoverflow.com/questions/722052/this-row-already-belongs-to-another-table-error-when-trying-to-add-rows – Rawling 2012-04-16 09:49:18