G
Guest
I have been building a class around a xml document that is the representation
of several tables from our sql2k database. The class has your standard
methods such as load and save but I have also been adding in properties to
allow for easy access to the the underlying xml document.
My problem is this. I would like to strongly type the properties to match
as closely with the sql2k types they are store in. For instance I have an
integer field called credits and a datetime field called last_achieved in my
table test. Both of these column can be null.
In the xml they are respresented as
<data credits="1" last_achieved="2005/05/01"/>
Now I have two properties on my class called credits and last_achieved that
look something like this.
public readonly property credits() integer
get
return cint(myxmldatanode.getAttribute("credits"))
end get
end property
public readonly property last_achieved() dateadntime
get
return cdate(myxmldatanode.getAttribute("last_achieved"))
end get
end property
Now the above works fine except under the condition where credits or
last_achieved are null within the database. Then the xml would look like:
<data credits="" last_achieved=""/>
Now obviously the properties will blow up. What I want the properties to
return is the system.dbnull value but this value can not be case within
either a dateandtime or integer type.
So my question is how can I do this?
Cheers in advance
Keith Chadwick
PS: If there is a typo in the above code sorry as I typed it in and did not
copy.
of several tables from our sql2k database. The class has your standard
methods such as load and save but I have also been adding in properties to
allow for easy access to the the underlying xml document.
My problem is this. I would like to strongly type the properties to match
as closely with the sql2k types they are store in. For instance I have an
integer field called credits and a datetime field called last_achieved in my
table test. Both of these column can be null.
In the xml they are respresented as
<data credits="1" last_achieved="2005/05/01"/>
Now I have two properties on my class called credits and last_achieved that
look something like this.
public readonly property credits() integer
get
return cint(myxmldatanode.getAttribute("credits"))
end get
end property
public readonly property last_achieved() dateadntime
get
return cdate(myxmldatanode.getAttribute("last_achieved"))
end get
end property
Now the above works fine except under the condition where credits or
last_achieved are null within the database. Then the xml would look like:
<data credits="" last_achieved=""/>
Now obviously the properties will blow up. What I want the properties to
return is the system.dbnull value but this value can not be case within
either a dateandtime or integer type.
So my question is how can I do this?
Cheers in advance
Keith Chadwick
PS: If there is a typo in the above code sorry as I typed it in and did not
copy.