Hello,
I am comparing if value is greater than zero. But it throws an error saying object cannot be cast from DBNull to other types
The if condition i am using is
Convert.todouble(DTname.item(columnname))>0
Can someone help with this ?
Hello,
I am comparing if value is greater than zero. But it throws an error saying object cannot be cast from DBNull to other types
The if condition i am using is
Convert.todouble(DTname.item(columnname))>0
Can someone help with this ?
Hi,
How about the following condition?
not DBnull.Value.Equals(DTname.item(columnname)) andalso Convert.todouble(DTname.item(columnname))>0
Regards,
Hi @diya_poovamma ,
Could you maybe modify the if condition to the below and let us know if it works :
DTname(columnName).ToString.IsNumeric andAlso Convert.Todouble(DTname(columnname))>0
This is assuming that the DTname
variable being used is of the type DataRow
, if not, we would need to know what is the Datatype of the DTname
variable and what exactly you are trying to perform.
Additionally, you could share screenshots by Debugging so we can get more transparent on the data present.
What is and also ?
A differeny condition,?
It is similar to the and
but it is short circuited , you can check the below info :
We are basically eliminating the operation of evaluating the Second Expression if the First Expression itself produces false, as we know that if any one of the condition in an and condition is false it results in false value.
Documentation :