if temp is dbnull.value or temp = 0
produces the error *Operator ‘=’ is not defined for type ‘DBNull’ and type ‘Integer’.**
while this one works like a charm!
if the temp is dbnull.value OrElse temp = 0
OrElse is a short-circuiting operator Or is not.
By the definition of the boolean ‘or’ operator, if the first term is True then the whole is definitely true – so we don’t need to evaluate the second term.
OrElse knows this, so don’t try and evaluate temp = 0 once it’s established that temp Is DBNull.Value
Or doesn’t know this, and will always attempt to evaluate both terms. When temp Is DBNull.Value, it can’t be compared to zero, so it falls over.
You should use… well, whichever one makes sense.
Posted Date:- 2021-09-21 04:15:21
What is the difference between ‘system.string’ and ‘system.string builder’ classes?
What do you understand by Global Assembly Cache (GAC)?
What is your understanding of .net framework?
What are Destructors in VB.NET?
Enlist Tools for VB.NET Development.
Explain Friend Access Modifier in VB.NET.
Enlist the Differences between VB and VB.NET.
Difference between System.String and System.StringBuilder classes?
What is the use of Option explicit?
What are the types of generations in garbage collector?
What are all the differences between Dispose and Finalize()?
What is ReDim keyword and its use?
Test if an object implements an interface
Difference Between Vb Dll And Assemblies In .net ?
Is Vb.net Object Oriented? What Are The Inheritances Does Vb.net Support ?
What are all the differences between Dispose and Finalize()?
What is jagged array in VB.Net?
What is the use of New Keyword?
Difference between int and int32?
Difference between System.String and System.StringBuilder classes?
What is Garbage Collection in VB.net?
Explain jagged array in VB.Net?
What are Option Strict and Option Explicit?
What Is Intermediate Language In .net ?
How Do You Rate Yourself In .net ?
How Do You Validate Date By Using Which Validation Control?
How Can We Assigns Items On Listbox So That It Will Show Rowwise Please Write The Code For It.
What are Option Strict, Option Explicit, and INTERNAL keyword in.Net Framework?
What is INTERNAL keyword in .Net Framework?
Explain Metadata, namespace, which namespace is used for accessing the data, What is JIT?
What are the different types of assembly?
What's the difference between or and OrElse?
What is strong name in .NET assembly?
What is an assembly and its use?
Which namespace are used for accessing the data?
Define CTS in the Vb.Net framework?