WinForm Column cannot be added because its CellType property is null.
在Winform DatatGridView 控件中绑定了一个模型的属性,结果在生成窗口时,发生错误,异常信息如下 :
Column cannot be added because its CellType property is null.
at System.Windows.Forms.DataGridView.OnAddingColumn(DataGridViewColumn dataGridViewColumn)
at System.Windows.Forms.DataGridViewColumnCollection.Add(DataGridViewColumn dataGridViewColumn)
at System.Windows.Forms.DataGridView.CorrectColumnFrozenStates(DataGridViewColumn[] dataGridViewColumns)
at System.Windows.Forms.DataGridView.OnAddingColumns(DataGridViewColumn[] dataGridViewColumns)
at System.Windows.Forms.DataGridViewColumnCollection.AddRange(DataGridViewColumn[] dataGridViewColumns)
找了好半天才找出问题的原因,绑定的属性在数据库表中不存在的列名
解决方案如下 :
1. 绑定的字段一定要与数据库表中的列的字段名相同
2. 如果是模型,这个模型的属性字段在数据库中没有,那就不用把属性写在datagridView 的列中,在设置datasource 后,直接设置列的可见 性
WinForm Column cannot be added because its CellType property is null.的更多相关文章
- 【Oracle 12c】最新CUUG OCP-071考试题库(53题)
53.(12-14) choose the best answer: Examine the command to create the BOOKS table. SQL>CREATE TABL ...
- xUtils3的简单介绍
xUtils3的简介 xUtils是基于Afinal开发的目前功能比较完善的一个Android开源框架,最近又发布了xUtil3.0,在增加新功能的同时又提高了框架的性能. 1.xUtils包含了很多 ...
- xUtils使用详细介绍
xUtils3使用详解 一.xUtils简介: xUtils是基于Afinal开发的目前功能比较完善的一个Android开源框架,官网:https://github.com/wyouflf/xUtil ...
- Android Xutils3 完全解析
1.先来认识一下xUtils3 1)xUtils3简介 xUtils是基于Afinal开发的目前功能比较完善的一个Android开源框架,最近又发布了xUtil3.0,在增加新功能的同时又提高了框架的 ...
- Mysql官方文档中争对安全添加列的处理方法。Mysql Add a Column to a table if not exists
Add a Column to a table if not exists MySQL allows you to create a table if it does not exist, but d ...
- 详解如何利用FarPoint Spread表格控件来构造Winform的Excel表格界面输入
我们先来简单了解一下WinForm和FarPoint,WinForm是·Net开发平台中对Windows Form的一种称谓.而FarPoint是一款模拟EXCEL的控件.它可以根据用户的要求实现很大 ...
- oracle ORA-01747(系统保留关键字)user.table.column, table.column 或列说明无效 hibernate映射oracle保留关键字
1.查询系统关键 select * from v$reserved_words 确认你使用的是否为关键字: select * from v$reserved_words w where w.KEYWO ...
- 11G新特性 -- Multicolumn Statistics (Column groups)
默认oracle会收集表中各个列的统计信息,但是会忽略列之间的关联关系.在大多情况下,优化器假设在复杂查询中的列之间是独立的.当where子句后指定了一个表的多个列条件时,优化器通常会将多个列的选择性 ...
- mybatis column 和property
mybatis map文件中 resultMap中column和sql查询结果对应, property和实体private对应 <resultMap id="VideoYcAppRes ...
随机推荐
- #define中 #与##的神奇用法
本文整理自csdn. #define f(a,b) a##b #define d(a) #a #define s(a) d(a) void main( void ) { puts(d ...
- MySQL数据库篇之初识数据库
主要知识点: 一.数据库概述 二.mysql安装与基本管理 1️⃣ 数据库概述 1.什么是数据(Data)? 描述事物的符号记录称为数据,描述事物的符号既可以是数字,也可以是文字.图片,图像.声音. ...
- go_常量与枚举
package main import ( "fmt" "math" ) //常量的数值可以作为各种类型使用 func consts(){ const file ...
- 341. Flatten Nested List Iterator展开多层数组
[抄题]: Given a nested list of integers, implement an iterator to flatten it. Each element is either a ...
- devcloud
zone名字:devcloud 外网dns:8.8.8.8 内网dns:10.0.2.3 提供点名称:devcloud cs bug问题:https://issues.apache.org/j ...
- 批处理for命令详解(转)
FOR这条命令基本上都被用来处理文本,但还有其他一些好用的功能! 看看他的基本格式(这里我引用的是批处理中的格式,直接在命令行只需要一个%号)FOR 参数 %%变量名 IN (相关文件或命令) DO ...
- Oracle 用户验证日志
1.sysdba/sysoper 权限用户验证日志;2.非sysdba/sysoper 权限用户验证日志;3.关于sqlcode; 1.sysdba/sysoper 权限用户验证日志:在数据库设置了参 ...
- 实践作业3:白盒测试----第三次小组会DAY8
我们小组于12月11日在东九教学楼召开了会议,小组第二次会议中就讨论了被测系统中风险最高的模块,于是选择管理员的教师添加模块,针对代码展开静态评审.这一次会议,小组主要讨论了应该从哪些方面来测评代码的 ...
- cmd 中连接mysql时报'mysql'不是内部或外部命令,也不是可运行的程序或批处理文件,该怎么办?
假设安装的mysql目录是D:\MySQL\MySQL_Server_5.5\第一种方法:如果你打开cmd后直接输入mysql是不行的,需要配置mysql的环境变量,那么就在环境变量中增加D:\MyS ...
- VWAP算法(成交量加权平均价)
算法交易其实主要是用在基金公司.券商量化比较多.例如我已经选好股,要大量买入,但是单凭交易员的操作海量单而且要完成买入100万股这些的操作是有点的困难的.那么这时候怎样解决拆单,防止冲击成本的问题呢? ...