hi all ,
i am getting error when i am converting dbnull value to integer value .
please help me how to solve this type of error
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
RahulRank #679 · 3.5K reputationPosted Jul 21, 2017, 12:13 AM EDT
int y = (!reader["WhatEverProperty"] is DBNull) ? Convert.ToInt32(reader["WhatEverProperty"]) : 0;Rafnas T PRank #280 · 8.8K reputationPosted Jul 21, 2017, 3:05 AM EDT
Puneet KankarRank #446 · 5.6K reputationPosted Jul 21, 2017, 3:36 AM EDT
int y = (!reader["PublicationYear"] is DBNull) ? Convert.ToInt32(reader["PublicationYear"]) : 0;