Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to handle the return values of sql stored procedures in qt application for inserting,delete,update..........

How to handle the return values of sql stored procedures in qt application for inserting,delete,update..........

Scheduled Pinned Locked Moved Unsolved General and Desktop
22 Posts 4 Posters 8.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    veera
    wrote on 5 Jul 2017, 06:57 last edited by VRonin 7 May 2017, 07:02
    #21

    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 as

    ALTER 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...

    1 Reply Last reply
    0
    • V Offline
      V Offline
      veera
      wrote on 5 Jul 2017, 06:58 last edited by
      #22

      I am checking the stored procedure's return value in my qt application.....

      1 Reply Last reply
      0

      21/22

      5 Jul 2017, 06:57

      • Login

      • Login or register to search.
      21 out of 22
      • First post
        21/22
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved