oracle get primary key value after an insert

53 views
Skip to first unread message

Justin

unread,
Nov 18, 2010, 11:41:12 AM11/18/10
to DbLinq
All,

Using oracle and DBLinq, how can I perform an insert and get the
sequence value back into my primary key? I cannot figure it out.

I have something like this:

Employee emp = new Employee();

emp.Name = "joe";

db.Employee.InsertOnSubmit(emp);

db.SubmitChanges();

// how do I get the primary key value now?

int recordID = emp.ID; // ID returns 0 but is 9 in the database table

Thanks for any help!

/Justin
Reply all
Reply to author
Forward
0 new messages