在Access DB中插入空值 [英] Inserting Null Values in Access DB

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

问题描述

大家好,

无法在Access DB中数字数据为空值的地方插入记录.
我大约有58个字段和500个记录.

有没有可能做插入的方法?

非常感谢

Shaheen

Hi all,

Am unable to insert record where there is null values for numeric data in Access DB.
I have approximately 58 fields and 500 records.

Is there any possible way to do the insert?

Many Thanks

Shaheen

推荐答案

仅当该字段可为空时,才可以在该字段中插入一个空值.如果它不能为空,则有两种选择.更改列类型,使其可以为空;插入诸如int.MinValue之类的前哨值以模拟此值,并根据数据执行操作以在出局时将其转换为null.

插入时,您将提供一个DBNull以便将null添加到该列中.
You can only insert a null value into a field if that field is nullable. If it is not nullable, you have two choices; change the column type so that it can be null; insert a sentinel value such as int.MinValue to simulate this and act on the data to convert it to a null on the way out.

When you insert, you supply a DBNull to add null into the column.


这篇关于在Access DB中插入空值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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