|
Subject:
|
The DBNull Class and IsDBNull Function
|
|
Posted By:
|
dschnedar
|
Post Date:
|
8/21/2008 1:25:13 PM
|
Pages 25,26 The code does not do what the text indicates that it does. "The first conditional is evaluated to True." --- The first conditional is NOT evaluated to TRUE
Dim sysNull As System.DBNull = System.DBNull.Value Dim strMyString As String = Nothing
If strMyString Is sysNull Then Console.WriteLine("1st condition is true") 'line_added strMyString = "Initialize my String" End If If Not IsDBNull(strMyString) Then Console.WriteLine("2nd condition is true") 'line_added Console.WriteLine(strMyString) End If Console.WriteLine("Done with dbNull test ") 'line_added
|
|
Reply By:
|
GMorris
|
Reply Date:
|
9/27/2008 9:13:29 AM
|
You are correct. But this might have worked in a previous version of VB.NET, and the author of that code likely assumed it would still work. Either that, or the author THOUGHT that the code was correct but didn't bother to test it. That's about all I can think of right now.
|