Issues while selecting values into nullable type property in Simple.Data

StackOverflow https://stackoverflow.com/questions/22179367

  •  05-06-2023
  •  | 
  •  

سؤال

I have a integer column in the database which is nullable. So while creating the datamodel i made the property "int?". This way my insert/update statement is working as expected.

However when I try to select data from the table into the same datamodel, the field is not getting populated. What am i doing wrong ? Can somebody please suggest ?

هل كانت مفيدة؟

المحلول

There was a mistake. The database column was in fact "VARCHAR". So I changed the model property to String, and things are now working fine.

So it appears that though Simple.Data is able to select VARCHAR coumn value into int model property, it somehow was failing to convert into int?. Changing model property to String sorted out the issue of both insertion/selection.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top