At the bar
-
With a former coworker and another friend of ours:
Him: (developing an ASP.NET app for internal use) I was having problems detecting null values...
Friend: Uh, "is DBNull"?
Him: So I rolled my own.
Me: Oh, jesus.
Him: I just take every table in the database...
Friend: ...
Him: ...loop through every column...
Me: You're going to wind up on TDWTF.
Friend: Dude. "Is DBNull."
Him: ...convert it to an empty string, check the length...
Me: It's part of the framework!
Him: Works great.
Me: ...
Friend: ...I personally would love to see his take on "void Batman()". TRWTF is that he reads the site, but missed the correct way to check for null values...
-
You, your coworker and friend on another topic:
You: So, you're trying to have a baby? Him: Yeah, but she just isn't getting pregnant; I think the condoms are causing a problem Friend: Why don't you just stop using them? Him: But I found a great workaround: I prick each one with a pin before ...
-
o is DBNull
DBNull.Value.Equals( o )
o == DBNull.Value
( o as DBNull ) != null
try { o.ToString() } catch { /* NULL */ } /* NOT NULL */
for( int i = int.MinValue; i < int.MaxValue; i++ ) if( i == o ) { /* o is not null (or not an integer) */ }
o.GetType().FullName == "System.DBNull"Ad nauseam.
-
[quote user="joe.edwards@imaginuity.com"] for( int i = int.MinValue; i < int.MaxValue; i++ ) if( i == o ) { /* o is not null (or not an integer) */ } [/quote]
I meant: for( int i = int.MinValue; i < int.MaxValue; i++ ) if( i == o ) { /* o is not null */ } /* o is null or not an integer */