Hi there

im trying to find an resolution to a problem im having.
I have an object which has several integer/date properties

I use a datareader to load data from the database into these objects.
The issue is when i have null values for the integer/date fields.

i use the following function to loaddata into the properties:
s Code:
  1. myobject.mynumber = getNullInt32(l_dr, 0)
  2.  
  3.  
  4. Private Function getNullInt32(ByVal p_reader As SqlDataReader, ByVal p_index As Integer) As Integer
  5.         Dim l_retInteger As Integer = Nothing
  6.         If Not p_reader.IsDBNull(p_index) Then
  7.             l_retInteger = p_reader.GetInt32(p_index)
  8.         End If
  9.         Return l_retInteger
  10.     End Function
so when my column has a null value in the table the function returns 0 which
sets the property myobject.mynumber to 0, when the value it not 0.

So i cannot distinguish the difference between a table field having 0 in it or nothing in it.


Is there any way to do the following from ASP 2.0 in ASP 1.1
s Code:
  1. Public Property mynumber as Nullable(Of Integer)

this is very frustrating.