How can I get the last inserted identity

Posts   
 
    
yoyo
User
Posts: 4
Joined: 25-Jul-2005
# Posted on: 25-Jul-2005 15:50:34   

Hi, I am having hard time with LLBL! Please help!!!

How can I get the last identity inserted in the table, I am using adapter.SaveEntity. Please send some code example!!!!!

HELP!!! Adolfo

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 25-Jul-2005 17:07:49   

That's been done for you: CustomerEntity has an identity column: customerID


CustomerEntity newCustomer = new CustomerEntity();
newCustomer.CompanyName = "Solutions Design";
//... rest of fields filled in here
adapter.SaveEntity(newCustomer);

int customerID = newCustomer.CustomerID;

Frans Bouma | Lead developer LLBLGen Pro