N
Nick Gilbert
Hi,
I have a database table which has some "float" columns which allow
nulls. I have created a TableAdapter to view this table.
If I open the TableAdapter and there are null values for some of the
float columns then an exception is thrown:
Line 2136: try {
Line 2137: return
((double)(this[this.tableProducts.MaxPressureBarColumn]));
Line 2138: }
Line 2139: catch (System.InvalidCastException e) {
[StrongTypingException: The value for column 'MaxPressureBar' in table
'Products' is DBNull.]
With string values, you can change the NullValue property to "null" in
the xsd file and all is well - however it won't let you do this for
anything other than strings even though .NET 2 supports null values for
ints floats and decimals etc...
Is there any way I can make this work? Or some kind of workaround I can use?
The only thing I can think to do is prevent the float columns from being
null and use 0 instead. But for some of the columns, zero is a valid
value and I need to be able to distinguish between 0 and null in the code.
Help!
Nick...
I have a database table which has some "float" columns which allow
nulls. I have created a TableAdapter to view this table.
If I open the TableAdapter and there are null values for some of the
float columns then an exception is thrown:
Line 2136: try {
Line 2137: return
((double)(this[this.tableProducts.MaxPressureBarColumn]));
Line 2138: }
Line 2139: catch (System.InvalidCastException e) {
[StrongTypingException: The value for column 'MaxPressureBar' in table
'Products' is DBNull.]
With string values, you can change the NullValue property to "null" in
the xsd file and all is well - however it won't let you do this for
anything other than strings even though .NET 2 supports null values for
ints floats and decimals etc...
Is there any way I can make this work? Or some kind of workaround I can use?
The only thing I can think to do is prevent the float columns from being
null and use 0 instead. But for some of the columns, zero is a valid
value and I need to be able to distinguish between 0 and null in the code.
Help!
Nick...