How to get output parameter after insert a record.

Posts   
 
    
chungpn
User
Posts: 39
Joined: 23-Mar-2011
# Posted on: 05-Apr-2012 11:58:04   

after execution this code: EmployeeEntity emp = new EmployeeEntity(); emp.Name = textBox1.Text; emp.Save();

I see in the ormprofiler this coce execute:

INSERT INTO [Employee] ([Name], [Picture]) VALUES (@p2, @p3);

SELECT @p1 = SCOPE_IDENTITY()

Can you show me how to get @p1 value after execute the code in client side.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 05-Apr-2012 22:18:11   

The @p1 result is assigned to your entity primary key field, in this case I think, EmployeeId. So to answer your question:

var p1 = emp.EmployeeId;
David Elizondo | LLBLGen Support Team
chungpn
User
Posts: 39
Joined: 23-Mar-2011
# Posted on: 06-Apr-2012 07:42:47   

thank you very much.