DBNull
noun
say it: “DEE-bee nul” /ˈdiːbiː nʌl/
The value ADO.NET uses for a database NULL, which is not the same as C#'s null.
What is DBNull in C#?
DBNull — The value ADO.NET hands you for a database NULL, as DBNull.Value. It isn't C#'s null, so check for it with reader.IsDBNull(...) before you read the column.
int column = reader.GetOrdinal("Region");
string? region = reader.IsDBNull(column) ? null : reader.GetString(column);
In a sentence
- “Reading the Region column threw an error until I checked for DBNull first.”
Level: Journeyman · More C# terms at this level
Updated