PrimeDigit – A Design Blog by Will Shaver

August 2, 2007

Fix DBNull Conversion Errors

Filed under: Exceptions — Will @ 6:51 pm

I had this really annoying problem earlier today with binding strongly typed datasets to a textbox. The fields I was binding from was sometimes null, causing this conversion exception that I couldn’t figure out how to catch. Turns out there’s a property for each field in the dataset called NullValue. Changing this property from “Throw Exception” to “Null” solved the problem.



I found this solution here. Thanks jcrabtressla.

Powered by WordPress