I have a Stored Procedure
that inserts different fields. But nevertheless there is that when being inserted I want to catch and put on the screen.
It is inserted into the database in the following way:
cmd.Parameters.AddWithValue("@numero", 0);
It is not inserting 0 here, what is happening inside the Stored Procedure is as follows:
IF @numero=0
BEGIN
BEGIN TRANSACTION
SELECT TOP 1 @ult_nr=nRequesicao FROM cabecalho
WHERE eliminado=0
ORDER BY 1 DESC
SET @ult_nr=@ult_nr+1
INSERT INTO cabecalho(nRequesicao,nomeEmpresa,colaborador,nota,local_entrega)
VALUES(@ult_nr,@empresa,@empregado,@obs_cab,@local)
INSERT INTO linhas(nRequesicao,quantidade,descricao,valor,observacoes)
VALUES(@ult_nr,@qtd,@produto,@valor,@obs_linha)
SELECT * FROM V_Requisicao
WHERE nrequesicao=@ult_nr
ORDER BY id
COMMIT
END
ELSE
BEGIN
INSERT INTO linhas(nRequesicao,quantidade,descricao,valor,observacoes)
VALUES(@numero,@qtd,@produto,@valor,@obs_linha)
SELECT * FROM V_Requisicao
WHERE nrequesicao=@numero
ORDER BY id
END
How can I get the last value and put it in a Label?