Set entity datetime property to null?

Posts   
 
    
jokohews
User
Posts: 8
Joined: 09-May-2011
# Posted on: 09-May-2011 20:40:24   

Is there a way to set a datetime to null. The db value is null, then if it is set I'm having a problem trying to reset it back to null.

Typically you can intercept this in the sproc and make sure 1/1/0001 doesn't get set in the db, but how can I do this with LLBGen entities?

Thanks,

Jay

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 10-May-2011 06:12:34   

Hi Jay,

Please tell us what is the LLBLGen version you are using. (http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=7722)

Also, please post a simple code snippet that demonstrate your situation. In this case for instance, is not clear what is the exactly flow you are following. For instance: - The column value is NULL in DB - Then you set a field to something else - At this point, Did you save the entity? - Then you want to set the field to NULL and save it back.

If you want to know more about how to set field values to NULL, read this (assuming you are using v3.x).

David Elizondo | LLBLGen Support Team
jokohews
User
Posts: 8
Joined: 09-May-2011
# Posted on: 10-May-2011 16:48:50   

daelmo wrote:

Hi Jay,

Please tell us what is the LLBLGen version you are using. (http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=7722)

Also, please post a simple code snippet that demonstrate your situation. In this case for instance, is not clear what is the exactly flow you are following. For instance: - The column value is NULL in DB - Then you set a field to something else - At this point, Did you save the entity? - Then you want to set the field to NULL and save it back.

If you want to know more about how to set field values to NULL, read this (assuming you are using v3.x).

Thanks for the reply - I'm using 2.6, though I'm able to use the link you sent to set the property to null. I was having an issue with a null DateTime setting the property to 01/01/0001, but setting the property null directly works.

Thanks,

Jay