我想根据特定的过滤条件过滤我的DataTable。
这是我的密码:
parameters = objPatientBizProcessing.GetFilterParameters(campusSelection, statusSelection);
filterOption3 = "pat_status = '" + parameters[1] + "'";
foreach (DataRow dr in dt.Rows)
{
dataRows = dt.Select(filterOption3, "id");
foreach (DataRow dr1 in dataRows)
{
dt1.Rows.Add(dr1);
}
}我的dt中总共有10条记录,基于filterOption3,我正在将结果过滤到dt1。
错误:
这一行属于另一个表
我不允许使用DataView。
有解决办法吗?
发布于 2011-04-13 07:28:12
只能将行添加到使用该表上的DataTable创建的dt.NewRow()中。您需要使用dt.ImportRow(row)。
您不能直接使用select中的dataRows集合吗?
https://stackoverflow.com/questions/5645760
复制相似问题