RMTWeb

View Original

ASP.Net load items - an efficient way to check for isDBNull to populate a control

This was the original way to check for a database field being null before putting it into a label:if not isDBNull(dr("FieldName")) thenMe.label1.text = dr("FieldName").ToStringelseMe.label1.text = ""end ifhowever there is a much better and more efficient way....Me.label1.text = dr.field(of String)("FieldName")Sorted!