ASP.NET DBNull Value

The DBNull represents an uninitialized variant or nonexistent database column. It is not the number zero or it is not an empty string value. DBNull is a singleton class, which means only this instance of this class can exist. The DBNull.Value member represents the sole DBNull object.

In many situations while reading data from DataSource, we have seen the error message like the following :

This message is getting because the ASP.NET program unable to handle DBNull value. In these cases you can determine whether a value retrieved from a database field is a DBNull value by passing the value of that field to the DBNull.Value.Equals method.



The following ASP.NET program is checking wether the retrieved values is DBNull.


Click the following links to see full source code

C# Source Code
VB.NET Source Code
default.aspx.vb (C) 2021    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.
SiteMap  | Terms  | About