Monthly Archives: January 2005

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

Revising BCL Whidbey Talk once again for ASPConnections

In preparation for ASPConnections, I am revising my What’s New in the Whidbey Base Class Libraries talk for the 3rd time. I first wrote it against the PDC bits and presented it last February. Then I revised it with the May 2004 bits to present at DevTeach in June. For ASPConnections in November, I used the October CTP (which I put on my demo box just days before the conference). Now I am updating it again using the November CTP. I am also trimming it down and shifting some of the focus. Most importantly for this version of the talk (as for what I did in November) is to focus on what is of use and of interest to developers writing ASP.NET Applications. I think these bits are really close to what we will see in Beta 2. If it is out before this conference, I will definitely update the demo box before the show.

http://www.AcehAid.org

Excitement brewing over upcoming MDC (Middle East Developer Conference)

Starting with a keynote by Bill Gates and filled with .NET stars from the Middle East (including INETA MEA Region Head, Goksin Bakir) and also some from the states (Kimberly Tripp, Patrick Hynds and Stephen Forte), this years MDC starts in a few days. Over on geekswithblogs, Mohamed Ahmed Meligy writes about how excited he is to attend this event.

http://www.AcehAid.org

Also at Windows Anywhere- a panel of Tablet Application developer/vendors!

In addition to my In Depth Tablet Web Applications presentation at Windows Anywhere in (2/6-10 in San Francisco) I just found out that I get to be on a panel with a bunch of Tablet developers and vendors (who are also developers).

Influencing Tablet PC Solutions–Tablet PC ISV, Wednesday, February 9, 2:00 pm to 3:00pm

Here are the other members of the panel session, all of whom have done some major tablet pc development and have real products on the market. I’ll be the dabbler (or is that doodler) on the panel, that is for sure!

Joerg Lenz, SOFTPRO
Sean Campbell, 3Leaf 
Steve Hoffman, ActiveInk Software 
Josh Einstein, Einstein Technologies 
Teresa Shu, xThink 
Brad Baldwin, Agilix

http://www.AcehAid.org

Conference Expo Passes: Only $25 for San Fran: VSLIve/Windows Anywhere, Free for Boston: Web Edge

Loren Heiny pointed this out. For $25 you can get into the exhibit hall at this 6 conference show in San Francisco (feb 6-10). I’ll be there to speak at the Windows Anywhere conference  – In Depth: Tablet PC Web Development.

Here is the list of exhibitors

If you are in the northeast – you can get into the expo hall at the Sys-Con Web Services Edge East conference (Feb 15-17) along with  the keynotes and workshops for free.

 

http://www.AcehAid.org

the .NET Celebrity Charity Auction: Why the bids still all say $100

multi-item auctions are REALLY wierd on ebay.

According to EBay’s algorithm (designed for the thrifty, not for the charitable) nobody is supposed to have to pay more than the lowest winning bid. So, though many have already bid more than $100, there are still not enough bids to push away the last of the $100 winning bids. Therefore all of the “winning bids” still are sitting at $100. I don’t know what it will take to get these things moving. Lots of bids. Lots and lots of bids. EBay doesn’t really like charity auctions, I think.

Here’s from the eBay site about multi-item auctions:

Bids are displayed when you click on the “Bidders list” link. Bids that are not currently winning show their bid prices, but bids that are winning show the price that they would pay if the auction ended immediately. This means that, in the Bid History, all winning bids show the same price per unit – the lowest winning bid. To place a winning bid (a bid that wins at least some units), you need to exceed this price.



http://www.AcehAid.org

Don Kiely: “will work for Indian food”

Don Kiely says he just can’t get good Indian food where he lives in Alaska. When he came to Vermont in July we took him out for Indian one night. It was his only requirement during the whole visit. Now he is in Alberta and I see that he went out again with John Bristowe for Indian last night.

Don who is a new addition to the INETA Speaker Bureau is speaking at the Alberta.NET user group today as an INETA speaker. Yippee.

http://www.AcehAid.org