根据枚举动态扩充datatable列

public void ConvertIDToNameForDataTable(DataTable dt, string srcColName, Type enumType)
        {
            dt.Columns.Add(new DataColumn(srcColName + "Name"));
            dt.Rows[0][srcColName + "Name"] = Enum.GetName(enumType, (int)dt.Rows[0][srcColName]);
        }

posted @ 2011-09-21 18:41  KimSky  阅读(269)  评论(0编辑  收藏  举报