データ行フィルタ値をデータテーブルに挿入したいが、 "この行はすでに別のテーブルに属している"というエラーを返します。私はこのエラーを修正するために助けてください..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