By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,681 Members | 1,806 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,681 IT Pros & Developers. It's quick & easy.

Handling SQL DB null values : Integer, Date etc...

P: n/a
I find myself writing repetitive functions for handling null values
from my DB like so:

Private Function SetDateNull(ByVal p_date As Object) As Date
If (TypeOf (p_date) Is System.DBNull) Then
p_date = Date.MinValue
End If

Return p_date
End Function

Private Function SetIntNull(ByVal p_int As Object) As Integer
If (TypeOf (p_int) Is System.DBNull) Then
p_int = ""
End If

Return p_int
End Function

I use these functions like so:
_startDate = SetDateNull(dr("DBstartDate"))
_myNumber = SetIntNull(dr("myDBNumber"))

Is there any global way of handling null values coming from my DAL?
all of this code will like in m BLL.

Also, if i create a function to handle null values that is global,
where can i put it so all classes in my BLL will have access to run
the function?
Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a

1) there is an open source project that enable nullabe types

2) just for your knowledge this issue solved in whidbey (by using
templates Nullable<T>).

Natty Gur[MVP]

blog :
Mobile: +972-(0)58-888377
*** Sent via Developersdex ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.