get value from autonumber field

Posts   
 
    
nmarun
User
Posts: 27
Joined: 31-Jul-2006
# Posted on: 19-Jun-2007 22:21:56   

Hi,

Here's the table structure in an MS Access database:

ImageSet table ImageSetId - AutoNumber (Indexed with no duplicates) Name - text

Image table ImageId - AutoNumber (Indexed with no duplicates) ImageSetId - foreign key from ImageSet table Name - text

Now when I do something like:

ImageSetEntity ImageSet = new ImageSetEntity();
ImageSet.Name = 'new image set'
ImageSet.Save();

Soon after this, I try:

int ImageSetId = ImageSet.ImageSetId

or

int ImageSetId = ImageSet.ImageSetId.Value

and in the debug mode, I see that ImageSet.ImageSetId and ImageSet.ImageSetId.Value are both null.

For some reason, I'm not getting the 'identity' value from a newly added entity. Please let me know how to get around this issue.

Thanks for any help in advance, Arun

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 20-Jun-2007 08:42:41   

which LLBLGen Pro runtime library version are you using? (http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=7725)

nmarun
User
Posts: 27
Joined: 31-Jul-2006
# Posted on: 20-Jun-2007 17:42:41   

My mistake, I should have provided that information.

SD.LLBLGen.Pro.DQE.Access.NET20.dll - version 2.0.0.60712 SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll - version 2.0.0.60722

Initially this field was not of type 'AutoNumber'. I modified the schema and also regenerated the llblgen code, but still did not help.

Thanks Arun

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39912
Joined: 17-Aug-2003
# Posted on: 20-Jun-2007 22:53:24   

nmarun wrote:

My mistake, I should have provided that information.

SD.LLBLGen.Pro.DQE.Access.NET20.dll - version 2.0.0.60712 SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll - version 2.0.0.60722

Initially this field was not of type 'AutoNumber'. I modified the schema and also regenerated the llblgen code, but still did not help.

Thanks Arun

You also refreshed the catalog?

ALso, please consider downloading the latest runtime builds, as yours are pretty old simple_smile

Frans Bouma | Lead developer LLBLGen Pro
nmarun
User
Posts: 27
Joined: 31-Jul-2006
# Posted on: 20-Jun-2007 23:33:10   

Support team,

Please close this thread. I ended up not needing this feature.

Thanks Arun