public static DataTable ModifyColumnName(DataTable dt, string F_1Str) {
//复制dt表数据结构
DataTable dtNew = dt.Copy();
dtNew.Clear();
//查询数据
DataRow[] Rows = dt.Select("F_1<>'"+ F_1Str + "'");//支持or;
//新的table插入数据
foreach (DataRow DR in Rows)
{
dtNew.ImportRow(DR);
}
//查询更改列名
DataRow[] RowsColumn = dt.Select("F_1='"+ F_1Str + "'");//支持or;
for (int i = 0; i < RowsColumn[0].ItemArray.Length; i++)
{
int Index = i + 1;
//修改DataTable列名
dtNew.Columns["F_" + Index + ""].ColumnName = QConvert.ToString(RowsColumn[0].ItemArray[i]);
}
return dtNew;
}