If myFIeld Is DBNull.Value Then
'...
End If
Main Topics
Browse All TopicsGood Day
Experts:
How can I test for Null in a Date defined field? When I look at the newly added Date defined field in Visual Studio Manager it says NULL. In my VB.net program I want to test for NULL and cannot figure out how to do so.
Thanks,
jimbo99999
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Jimbo9999 - Here is an example of how to do this:
Dim table As New DataTable()
table.Columns.Add("MyDate"
table.Rows.Add(New Object() {Nothing})
'Test field for Null
If table.Rows(0).Item("MyDate
MsgBox("It is Null")
Else
MsgBox("Value is: " & table.Rows(0).Item("MyDate
End If
Hey There
Thanks for replying everyone. I am currently trying what VBRocks suggested. For some reason
I am still not getting NULL evealuated correctly even though I look in the database and the date field on the record says NULL. So, I step through the program to find that it says there is a value of 12/30/1899 in the field.
Anyone seen that before? It is a new one one me. Not sure what to do now. Any ideas?
Thanks,
jimbo99999
Business Accounts
Answer for Membership
by: DreamMasterPosted on 2008-09-03 at 07:06:12ID: 22377324
Should be something like
If IsDBNULL(fieldname) Then
'handle this here
Else
'do something else
End If