Category Archives: dotNET

Vermont.NET, Rob Howard and Vermont Weather

Watch here for updates on meeting status! I will feed them to the VTdotNET site as well.

Rob Howard is scheduled to speak at Vermont.NET tonight. Everyone is very excited and I have a lot of RSVPs. But now we have a snowy blustery morning and a forecast for it to be like this all day. Rob’s flight is due in at 5pm and the meeting is at 6pm.

I did just speak to Rob on his way to the airport in DFW and he’s going to go for it, at least as far as Chicago then we’ll figure it out from there.

We can watch his Chicago -> Burlington flight status here. And the weather forecast here.

 

http://www.AcehAid.org

Nullable Types and Database nulls…how, exactly?

I love the concept of Nullable<T> being able to deal with null data coming out of the database – especially ints and datetimes. The only problem is that I cannot figure out how to leverage Nullable<T> with data coming from a database. I still have to test for null. I have also talked with Sahil Malik at length about this. He is just as confused. I have tried it in a number of different spots — from the data layer to the business layer —  with no luck.

Let’s say I’m working with a Nullable<Int32>. I have created a SqlDataReader from some SQL Server data.

Nullable<Int32> does not seem to grok System.dbNull. (Invalid Cast). That means I cannot assign mySqlDataReader.item(“myintfield”) directly to my Nullable<Int32> when it is null.

Though you *can* cast an Int to a Nullable<Int>, you cannot use DataReader’s GetInt32 method on a null database value. (SqlNullValueException). Therefore I can’t get at the null value this way either (without explicitly testing for Null myself).

So, let’s say I load the data into a DataTable.

I happen to know that my null integer is in the “someintdata” column of my 2nd row – so I am just coding specifically to test that data. This column is an Integer.

.NET will not implicitly  cast myTable.Rows(1).Item(“someintdata”) into my Nullable<Int>. It won’t even compile and helpfully suggests that I explicitly cast it.

Nor can I explicitly cast it. That attempt throws an InvalidCastException. It doesn’t like the null.

So it seems that no matter what,  I still have to test for Null before I can extract the data. And if I have to do that, what is the Nullable<T> buying me in this case?

(This is one of those posts that I worry I have *really* missed something obvious and am going to look like a total fool, but I am just going to go for it anyway…)

http://www.AcehAid.org

Code Camp III Room Reservations – looking for a FEMALE roommate

Thanks for the reminder Dave! Since I’m going to Code Camp (sure hope my sessions get selected), his post made me think to actually book my room.

So I booked a room at the Waltham Westin. Funny, they have an internet discount of 15% but it is a non-refundable reservation. I could get a 21 day AAA discount, but it, too, is non-refundable. So I paid the regular room rate. (I just hate being locked into anything) Got two beds. Looking for a chick roomie for 3/12 to split the cost.

http://www.AcehAid.org

Burlington Code Brew Feb 2nd

VTdotNET member Zachary Kent has set the date for the first Vermont Code Brew. It will be February 2nd from 6-8pm.

Zach has created a Yahoo Group to help manage this.

Group name: VTCodeBrew
Group home page: http://groups.yahoo.com/group/VTCodeBrew
Group email address: [email protected]

The first meeting will be at his office so except Root Beer not Draft Beer!!

He’s getting the knack of the blog world since his first Yahoo group post points to Bill Evjen’s Code Brew post and Robert Hurlbut’s Boston Code Brew post!

http://www.AcehAid.org