jamie_pattison
Well-known member
- Joined
- Sep 9, 2008
- Messages
- 116
- Programming Experience
- Beginner
I am attempting to convert a DBNull value to a decimal (0, 0.0, 0.00 etc).
My current code is
When i run my app i pass in the row to convert. Every other datatype works/runs as expected except Decimal. It runs with the abbreviated code below:
The Object.... line causes an error. The error is DBNull' to type 'Decimal' is not valid.... Ive tried many attempts to overcome this but cant get this to work. Could anyone guide me?
Thanks
My current code is
VB.NET:
If row.Item("Name of row") Is DBNull.Value Then
NameOfRow = Convert.ToDecimal(0.0)
End If
When i run my app i pass in the row to convert. Every other datatype works/runs as expected except Decimal. It runs with the abbreviated code below:
VB.NET:
For each row..in dataset....rows
Object = row.table("Table").Item("Name of row")
Next
The Object.... line causes an error. The error is DBNull' to type 'Decimal' is not valid.... Ive tried many attempts to overcome this but cant get this to work. Could anyone guide me?
Thanks