.Net - type error for Nullable int database field (SQL server backend)

.Net - type error for Nullable int database field (SQL server backend)

jaydonoghuejaydonoghue Posts: 3Questions: 1Answers: 0

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

Answers

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    Answer ✓

    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

This discussion has been closed.