markrendle / Simple.Data

A light-weight, dynamic data access component for C# 4.0
MIT License
1.33k stars 303 forks source link

Select values into nullable type #334

Closed anoop-kv closed 10 years ago

anoop-kv commented 10 years ago

Hi,

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 ?

WayneHiller commented 10 years ago

That should not be a problem I do it all the time. Do you have public get & set on the property in the data model

markrendle commented 10 years ago

This should work. Which database are you using?

On Tuesday, 4 March 2014, anoopkv2000 notifications@github.com wrote:

Hi,

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 ?

Reply to this email directly or view it on GitHubhttps://github.com/markrendle/Simple.Data/issues/334 .

Mark Rendle Founder & CEO Oort Corporation Makers of Zudio https://zud.io/

anoop-kv commented 10 years ago

I am using Oracle. And yes this is a public property in my model

WayneHiller commented 10 years ago

I have not tried it in oracle. Is it a normal column name with no special characters?

anoop-kv commented 10 years ago

Sorry, I made a mistake. The database column was in fact "VARCHAR". So I have changed the model property to String, and things are now working fine. Thanks for the pointer.