解决datatable中DataRow不能复制到另一个DataTable中
public static DataTable InitDgvProcessWorker() { ArrayList list=new ArrayList(); DataTable dt = new DataTable(); string str= "select WorkerNO as 工号,[Name] as 姓名,DutyContent as 职 责,[Group]
as 组名,upperson as 上层 " + " from UserInfo where [Group]='工序生产人员' "; string Sqlstr =DbHelper.DbHelperSQL.DataQuery(str).Tables[0]; dt = DbHelper.DbHelperSQL.DataQuery(Sqlstr).Tables[0]; DataTable ResultTable = dt.Copy(); ResultTable.Clear(); for (int i = 0; i < dt.Rows.Count; i++) { string upperson= dt.Rows[i]["上层"].ToString(); if (upperson.Contains(this.Name)) { ResultTable.ImportRow(dt.Rows[i]);//把 } } ResultTable.Columns.Remove("上层"); return ResultTable; }