THESE FORUMS ARE NOW FROZEN
Please choose "Forums" from the Main menu of www.entityspaces.net to get to our new forums.

After save the entity doesn't contain the autogenerated identity?

rated by 0 users
This post has 2 Replies | 0 Followers

Top 100 Contributor
Posts 25
kparker Posted: 11-19-2009 8:35 AM

I just upgraded to the latest version (2009.2.1012.0).

Previously, after I saved an entity my primary key column (ID, int, Identity=Yes)  would contain the value of the autogenerated identity after the save was executed.  Now, it's not working the same.

I'm sure this is something easy, but I'm not finding a solution on the forums.

thanks!

Top 100 Contributor
Posts 25

Out of habbit, I usually set the ID to -1 for new records.  If I do this, then save, it's not returning the updated autogenerated identity value.

Dim newBusinessInfo As New DAL.BusinessInfo
With newBusinessInfo
 .Id = -1
 .BusinessName = "some business name"
End With
newBusinessInfo.Save()

 

If I don't set the ID and then save, it does return the updated autogenerated identity value.

Dim newBusinessInfo As New DAL.BusinessInfo
With newBusinessInfo
 .BusinessName = "some business name"
End With
newBusinessInfo.Save()  

Top 10 Contributor
Posts 3,881

This has been fixed and is available in our latest Trial, it wont be in the developer release until our next build. However, to be honest, I'd stop setting it to -1, it just doesn't make sense to do so as a habit? Surprise

EntitySpaces | Twitter | BLOG | Please honor our Software License

Page 1 of 1 (3 items) | RSS
Copyright © 2005 - 2009, EntitySpaces, LLC