Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - Handling SQL DB null values : Integer, Date etc...

 
Thread Tools Search this Thread
Old 11-14-2003, 07:39 PM   #1
Default Handling SQL DB null values : Integer, Date etc...


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?


DKode
  Reply With Quote
Old 11-16-2003, 05:51 AM   #2
Natty Gur
 
Posts: n/a
Default Re: Handling SQL DB null values : Integer, Date etc...
Hi,

1) there is an open source project that enable nullabe types
:http://nullabletypes.sourceforge.net/

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

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Natty Gur
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
MCITP SQL Server 2005 or SQL Server 2008 Darrilgibson@gmail.com MCITP 0 12-19-2007 01:56 PM
getting integer values from electronic weigh scale through serial port dotnet_smart Software 2 09-17-2006 05:24 AM
getting integer values from electrolnic weigh scale through serial port dotnet_smart Hardware 0 07-28-2006 11:54 AM
Access Date/time to SQL to only show Date Whothehell Software 2 07-27-2006 06:11 PM
requesting a hand up - read for your Mom [short message with Quotes] Miss Marple DVD Video 1 03-17-2005 10:07 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46