.Net - type error for Nullable int database field (SQL server backend)
.Net - type error for Nullable int database field (SQL server backend)
jaydonoghue
Posts: 3Questions: 1Answers: 0
in DataTables
Hi,
I ran into a run time error when trying to save a value to a nullable int field. When saving, the following exception is thrown:
Type error - Data set for DatabaseFieldName is not of type Nullable`1
To fix this, I modified the Type method in Field.cs to get the base type when its nullable
public Field Type(Type t)
{
if (t.ToString().Contains("Nullable"))
_type = Nullable.GetUnderlyingType(t);
else
_type = t;
return this;
}
Could this be added into the .Net source?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi,
Thanks for this suggestion! Yes indeed it can - I've committed this in and it will be included in the 1.5.3 release which should be later this week.
Regards,
Allan