Hello, I'm performing an insert into a table, but I need it to return the ID you just entered. I searched the OUTPUT
command but could not solve my problem. I need to do all this using procedures, ie I also need to know how to "get" this return from the procedure.
Procedure:
CREATE PROCEDURE SaveProfessionalUser
@id int,
@title varchar(50)
AS
BEGIN
INSERT INTO ProfessionalType VALUES (@title)
END
Codebehind:
using (_context)
{
SqlCommand cmd = new SqlCommand("SaveProfessionalUser");
cmd.Parameters.AddWithValue("@idProfessionalUser", pUser.IdProfessionalUser);
cmd.Parameters.AddWithValue("@title", pUser.Title);
cmd.CommandType = CommandType.StoredProcedure;
this._context.ExecuteProcedure(cmd);
return true;
}