Hi,
Which is the best way to prevent this from throwing an exception, e.g. if it's null
(bool)(aDataTable.Rows[0]["aColumn"]))
Thanks
Hi,
Which is the best way to prevent this from throwing an exception, e.g. if it's null
(bool)(aDataTable.Rows[0]["aColumn"]))
Thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rajanikant HawaldarPosted Oct 11, 2022, 6:52 AM
Uttam KumarPosted Oct 11, 2022, 6:35 AM
You can use this code to avoid the exception.
Vishal YelvePosted Oct 11, 2022, 5:25 AM
use
Boolean.TryParse()
Jignesh KumarPosted Oct 11, 2022, 4:03 AM
Hi Jonson Bill,
Please check this one, incase your column has null vaue then it will return false.