![]() |
|
|
|||||||
![]() |
ASP Net - Handling SQL DB null values : Integer, Date etc... |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
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 |
|
|
|
|
#2 |
|
Posts: n/a
|
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 |
|
![]() |
| Thread Tools | Search this Thread |
|
|
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 |