Hi, I have the following code, where one element can be NULL.
My question is, how can I handle the NULL value, and assing a 0 to that element?
So far, no luck!
In the code, I tried the IF clause, but doesn't work at all...
the .PARTS_LENGTH element is defined as DOUBLE and is the value I'd like to make 0 if it's NULL.
Any help is much appreciated in advance.
Code:
Select New Class_Data_Inventory With {.PARTS_AC = CDbl(Data_Inventory.Element("PARTS_AC").Value), _
.PARTS_COMPANY = Data_Inventory.Element("PARTS_COMPANY").Value, _
.PARTS_DIAM = CDbl(Data_Inventory.Element("PARTS_DIAM").Value), _
[B][COLOR="Red"].PARTS_LENGTH = CDbl(If(Data_Inventory.Element("PARTS_LENGTH").Value Is Nothing, Data_Inventory.Element("PARTS_LENGTH").Value, "0")), [/COLOR][/B]_
.PARTS_NAME = Data_Inventory.Element("PARTS_NAME").Value, _
.PARTS_SD = CDbl(Data_Inventory.Element("PARTS_SD").Value), _
.PARTS_STOCK = Data_Inventory.Element("PARTS_STOCK").Value, _
.PARTS_TYPE = Data_Inventory.Element("PARTS_TYPE").Value}).ToList()
So far, no luck!
In the code, I tried the IF clause, but doesn't work at all...
the .PARTS_LENGTH element is defined as DOUBLE and is the value I'd like to make 0 if it's NULL.
Any help is much appreciated in advance.