I need to make something like :
if isdbnull(value) or value = something then 'do something else 'do something else end if
of course i get an error using this method , so my question is how do i rewrite it to avoid the "operator not defined for dbnull and something" error ?
There are a few approaches to this, and which you use may depend on the values you're working with. However, if you want something that catches all conditions then I'd do this:
This will check if the Value is nothing, which can sometimes happen without the value actually being DBNull.
But the most important part of this is the OrElse. OrElse is the short-circuiting operator which terminates the evaluation of the condition as soon as the runtime knows what the outcome will be. By contrast, the Or operator will execute the entire condition no matter what, and that is the reason your original code fails.
Now that I look at your example code again, I can see how my NotNull() function may help you: