If you want to handle the Null column values of the sqldatareader object in C#, you can use the SqlReader.IsDBNull method to validate for it.
If the SqlReader.IsDBNull returns true then , the value is considered to be a null value and you can take the ction accordingly.
How to handle Null Column values of SQLDataReader in C# ?
if (!SqlReader.IsDBNull("EmailAddress")) { emp.EmailAddress = sqlreader.GetString("EmailAddress"); }
Leave a Reply