saving new entity

Posts   
 
    
tprohas
User
Posts: 257
Joined: 23-Mar-2004
# Posted on: 09-Mar-2005 21:02:18   

I'm trying to save a new entity without changing any of its properties so that the table gets filled with all the column defaults. I am currently receiving an error when doing this. I know that the entities are meant to only save changed values, but if I don't change any values then it won't save. The only value being changed would be the PK identity value.

Is this possible?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 10-Mar-2005 11:45:43   

Yes, this is possible. Set all fields to null, using SetNewFieldValue(index, null);. This will mark the fields as changed, and will save a NULL into the fields, making the database to insert the default instead simple_smile

Frans Bouma | Lead developer LLBLGen Pro
tprohas
User
Posts: 257
Joined: 23-Mar-2004
# Posted on: 12-Mar-2005 01:09:45   

Otis wrote:

Yes, this is possible. Set all fields to null, using SetNewFieldValue(index, null);. This will mark the fields as changed, and will save a NULL into the fields, making the database to insert the default instead simple_smile

Thanks for the help Otis. I have this working now.

Regards,

Aaron