S
Smokey Grindle
I am using .NET 2.0 with this and have loaded a row into a data table... now
I want to move the info in that row into the fields of an object... what is
the best way to do this for fields that I know could be null... right now
say I have it set up like this
Object has fields
Private m_IsNotANull as string
private m_CouldBeNull as nullable(of datetime)
' now load row into this
m_IsNotANull = dt.row(0)("MyString").tostring
' ok this works easily, now how about null ones?
m_CouldBeNull = ???
I know I can check if the current value is null and do stuff like this
if dt.row(0)("CouldBeNullDate") isnot DBNull.value
m_CouldBeNull = diretcast(dt.row(0)("CouldBeNull"),datetime)
else
m_CouldBeNull = nothing
end if
but is that the easiest way to do it? what alternatives are out there?
thanks!
I want to move the info in that row into the fields of an object... what is
the best way to do this for fields that I know could be null... right now
say I have it set up like this
Object has fields
Private m_IsNotANull as string
private m_CouldBeNull as nullable(of datetime)
' now load row into this
m_IsNotANull = dt.row(0)("MyString").tostring
' ok this works easily, now how about null ones?
m_CouldBeNull = ???
I know I can check if the current value is null and do stuff like this
if dt.row(0)("CouldBeNullDate") isnot DBNull.value
m_CouldBeNull = diretcast(dt.row(0)("CouldBeNull"),datetime)
else
m_CouldBeNull = nothing
end if
but is that the easiest way to do it? what alternatives are out there?
thanks!