数据库中的空值 [英] null values from database

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

问题描述

大家好,我正在从本地数据库中获取数据,也正在从数据库中获取日期,有时该日期值将为空值,如何将该空值分配给我在vb中的日期数据类型.net.

hi all, i am getting data''s from my local database, also i am getting date from my database, some time that date value will be null value, how to assign that null value to my date data type in vb.net.

推荐答案

问题还不是很清楚,但是其中一个显而易见的部分是:.NET System.DateTime类型不能为空,因为这是一种结构,一种值类型.那么如何表达空时间呢?

答案是:您可以使用可为空的类型,而可以从(非可为空)值类型System.DateTime:
中产生
The question is not quite clear, but one apparent part of it is: .NET System.DateTime type is not nullable, because this is a structure, a value type. How to express the null time then?

The answer is: you can use nullable type you can produce out of the (non-nullable) value type System.DateTime:
System.DateTime structureValue = //... cannot be made null
System.DateTime? nullableTime = null; //assignment to null value is allowed



请参阅:
http://msdn.microsoft.com/en-us/library/1t3y8s4s.aspx [ ^ ].

—SA



Please see:
http://msdn.microsoft.com/en-us/library/1t3y8s4s.aspx[^].

—SA


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

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