从DataTable中删除不被控件支持的字段类型

时间:2023-07-11 20:23:08

DataTable dt = DB.GetDataTable(sql);
           
            //从dt中删除不被控件支持的字段类型
            for (int i = 0; i < dt.Columns.Count; i++)
            {
                Type tp=dt.Columns[i].DataType;
                if (tp == typeof(Byte[]))
                {
                    dt.Columns.RemoveAt(i);
                    i--;
                }
            }
           
            DB.DvBind(dvContent, dt, 1, true);