Generated strongly typed dataset - null date column - exception when Fill or GetData called on table

  • Thread starter Thread starter rharding
  • Start date Start date
R

rharding

Hi,

Does anyone have a workaround for the this:

This is all 2.0 vs 2005 - I generate a strongly typed dataset and table
adaptor in vs2005 but the oracle table its based on allows a date
column to be null - this shows up as "AllowDBNull = true" in the column
properties but when I call Fill or GetData on the generated dataset I
get an exception thrown because of the null date column in the table

Its not possible to set the nullValue in the properties to anything
other than "Throw Exception"

any ideas - what am I missing?

Thanks
Richard
 
Before you load your dataset, you need to go into the dataset and make sure
nulls are allowed in the definition of the field. You also need to make sure
the definition is correct in the data adapter definition. In VB 6 you have
to use an iif(isnull(datafieldname) action if null, action if not null).
 
When you use the Fill(..) method on the dataadapter, it should account
for the nullability of the target datatable. In this case, the problem
seems to be one I recently had..

The DateTime type is a struct that can technically never be null.

I actually recently hit this same issue, but not on fill(...). I wound
up writing a nifty "ToNullable(..)" method that I posted about:

It might have something to do with the Oracle provider. I'm curious to
know the answer myself.

Cheers!
-Sean
 
Back
Top