允许插入和更新为空值 [英] Allow null value for insert and updation

查看:69
本文介绍了允许插入和更新为空值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在使用ms访问作为后端的vb.net应用程序.
我使用execute-non query()插入数据.某些值在插入时为null.但是数据库是不允许的(发生错误).是否有可能允许空值?
请澄清.
谢谢.

Hi,
I am working on vb.net application with ms access as back end.
I using execute-non query() for insert data. Some values are null at time of insertion. but database can''t be allow (Error occurs). is it possible for to allow null value ?
Please clarify.
Thanks you.

推荐答案

在表的column属性中设置Allow NULL.
并且在插入数据或编写插入查询时,不要写/考虑要为空的列/不想插入值.
Set Allow NULL in the column property of the table.
and while inserting data or writing insert query dont write/ consider the column which u want to be null/ dont want to insert value.


有两种可能性.
1.您的列设置为NOT ALLOW NULL
2.您的字段值为空,并且您认为INSERT QUERY
中的该列
将您的列设置为ALLOW NULL并在插入之前检查字段值是否为NULL.
如果字段值为NULL,则不要在INSET查询中考虑该列.数据库将自动在该列中放入NULL.

您可以通过
允许您的列为空
There are two posibilities.
1. your column is set as NOT ALLOW NULL
2. your field value is null and your are consider that column in INSERT QUERY

Make your column as ALLOW NULL and check field value for NULL before insertion.
if field value is NULL, Do not consider that column in INSET query. Database will automatically put NULL in that column.

you can ALLOW NULL your column by
ALTER TABLE TABLENAME ADD COLUMNNAME text NULL


在Microsoft Access中处理空值的10个技巧 [ ^ ]


10 tricks for handling null values in microsoft access[^]


将访问列"允许空"的属性设置为是...".如果此解决方案不起作用,则显示错误.... :)
Set the properties Of Access Column "Allow Null" to Yes....And show the error if this solution is not work....:)


这篇关于允许插入和更新为空值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆