A New Internet Library: Add Your Website/Blog or Suggest A Website/Blog to our Free Web Directory http://anil.myfunda.net.

Its very simple, free and SEO Friendly.
Submit Now....

Tuesday, July 22, 2008

VB.NET NULL DATE

I have a problem checking for a NULL date.  I have a public shared function which handles Strings. 

 

contactName.Text = DBValueToString(dr("ContactName"), "Empty")

 

Public Shared Function DBValueToString(ByVal cellValue As Object, ByVal defaultValue As String) As String

If cellValue.ToString Is DBNull.Value.ToString() Then

Return defaultValue

Else

Return CType(cellValue, String)

End If

End Function

 

This works great for strings, but not Dates.  How would I check for dates that are NULL, without sending a default value?

 



Read Full article Here.

No comments:

Post a Comment

Post your comments here:

Originals Enjoy