How to handle the return values of sql stored procedures in qt application for inserting,delete,update..........
Unsolved
General and Desktop
-
wrote on 5 Jul 2017, 06:57 last edited by VRonin 7 May 2017, 07:02
Hi SGaist,
I am writing stored procedure in DBeaver-General GUI using MS SQL for inserting records into the tableview in qt application,i am sharing the my stored procedure asALTER PROCEDURE dbo.insert_data2 ( @ID INT, @Name VARCHAR(100), @Lastname VARCHAR(100), @contact INT, @EmailId VARCHAR(100), @ret INTEGER=NULL OUTPUT ) AS BEGIN If Exists (select ID from Info where ID = @ID) BEGIN SELECT @ret = -2 RETURN @ret; -- SELECT -2 as StatusID --ID already exists. So returning -2. Means, not successful END ELSE BEGIN INSERT INTO Info (ID,Name,Lastname,contact,EmailId) VALUES(@ID,@Name,@Lastname,@contact,@EmailId); --SELECT *FROM Info --SELECT 2 as StatusID SELECT @ret = 115; RETURN @ret; END END
after successful of insertion it needs to return value is "115" but returning 1 what I am doing wrong ,I did not understand please guide me right direction...
-
wrote on 5 Jul 2017, 06:58 last edited by
I am checking the stored procedure's return value in my qt application.....
21/22