Procedure in Firebird with C#

Asked

Viewed 104 times

1

Good evening

I’m new in Firebird, although I’ve handled it a few times, but nothing professional, but now due to a need the embedded solution has been set to use.

Well, I am developing a user recording interface with Stored Procedure by Ibexpert, when I run the code in this environment the return is zero as defined, but in the application (windows.Forms with C#) calling the Procedure by the Executescalar or Executenonquery method the return that arises is -1

Could any blessed person enlighten this person? I wanted to understand why the return is -1 and not 0 as defined.

(Below the code of the Procedure)

CREATE OR ALTER PROCEDURE IDB_SP_USU_GRAVA_USUARIO (
 in_usu_id integer,
 in_usu_log varchar(50),
 in_usu_pwd varchar(80),
 in_usu_nam varchar(80),
 in_usu_sta char(1),
 in_usu_dta_val date,
 in_prf_id integer)
 returns ( msg_ret integer )
 as
 BEGIN
 if ( :IN_USU_ID = 0 ) then in_usu_id = NULL;
 if ( ( :in_usu_dta_val < current_date) or (:in_usu_dta_val IS NULL)) then    IN_USU_DTA_VAL = dateadd(year, 1, current_date);

UPDATE or INSERT INTO idb_tb_usu_usuarios
    (usu_id, usu_log, usu_pwd, usu_nam, usu_sta, prf_id, usu_dta_inc, usu_dta_fin)
VALUES
    (:IN_USU_ID, :IN_USU_LOG, :IN_USU_PWD, :IN_USU_NAM, :IN_USU_STA, :IN_PRF_ID, CURRENT_DATE, :IN_USU_DTA_VAL);
MSG_RET = sqlcode;

END
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.