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