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

后端 未结 6 638
忘了有多久
忘了有多久 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:28

    Null is similar to zero pointer in C++. So it is a reference which not pointing to any value.

    DBNull.Value is completely different and is a constant which is returned when a field value contains NULL.

提交回复
热议问题