What is the difference between null and System.DBNull.Value?

后端 未结 6 635
忘了有多久
忘了有多久 2020-11-22 11:02

Is there any difference between null and System.DBNull.Value? If yes, what is it?

I noticed this behavior now -

while (rdr.Read())
{
    if (rdr[\"I         


        
6条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-22 11:08

    From the documentation of the DBNull class:

    Do not confuse the notion of null in an object-oriented programming language with a DBNull object. In an object-oriented programming language, null means the absence of a reference to an object. DBNull represents an uninitialized variant or nonexistent database column.

提交回复
热议问题