DBNull - How to get rid of annoying exception throwing

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi there,
I have a few fields (they are System.Decimal) that the system simply will NOT let me get rid of the NullValue Throw Exception property in the xsd file. If a field is empty, thats okay. The exception thing is getting out of hand. The default value shows as DBNull. I didnt ask it to throw exceptions and adding catch/try is pointless because it doesnt need it. If its empty, its empty. I dont care if its empty. Id like for it to assume a zero value, actually, so I would think that empty = 0.
When I deleted the offending exception code, thinking that if I dont care if a value is zero then it should be ok, the system thinks the field in question doesnt exist...when its clearly there in the project dataset!
The code Im talking about is this (looks like its system generated):
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")> _
Public Property orderadditonalcharges() As Decimal
Get
Try
Return CType(Me(Me.tableorders.orderadditonalchargesColumn), Decimal)
Catch e As Global.System.InvalidCastException
Throw New Global.System.Data.StrongTypingException("The value for column orderadditonalcharges in table orders is DBNull.", e)
End Try
End Get
Set(value As Decimal)
Me(Me.tableorders.orderadditonalchargesColumn) = value
End Set
End Property
How do I get rid of this annoying progress stopper?

Thanks!

View the full article
 
Back
Top