Featured post
.net - What is the point of DBNull? -
in .net there null
reference, used everywhere denote object reference empty, , there dbnull
, used database drivers (and few others) denote... pretty same thing. naturally, creates lot of confusion , conversion routines have churned out, etc.
so why did original .net authors decide make this? me makes no sense. documentation makes no sense either:
the dbnull class represents nonexistent value. in database, example, column in row of table might not contain data whatsoever. is, column considered not exist @ instead of merely not having value. dbnull object represents nonexistent column. additionally, com interop uses dbnull class distinguish between vt_null variant, indicates nonexistent value, , vt_empty variant, indicates unspecified value.
what's crap "column not existing"? column exists, doesn't have value particular row. if didn't exist, i'd exception trying access specific cell, not dbnull
! can understand need differentiate between vt_null
, vt_empty
, why not make comempty
class instead? neater fit in whole .net framework.
am missing something? can shed light why dbnull
invented , problems helps solve?
the point in situations there difference between database value being null , .net null.
for example. if using executescalar (which returns first column of first row in result set) , null means sql executed did not return values. if dbnull means value returned sql , null. need able tell difference.
- Get link
- X
- Other Apps
Comments
Post a Comment