Alpha Video Training
Results 1 to 4 of 4

Thread: How to get return code when runing stored procedures in Sql Server from Xbasic

  1. #1
    Member
    Real Name
    Javier Martinez-Gomez
    Join Date
    Aug 2013
    Posts
    3

    Default How to get return code when runing stored procedures in Sql Server from Xbasic

    Hello all

    SOmebody knows How to get return code when runing stored procedures in Sql Server from XBasic?

    Thanks in advance

    ------------
    I need the return code " @return " in the followinw query
    EXEC @return = StoredProcedure @param1,@param2
    Last edited by javiermgjz; 01-24-2014 at 01:34 PM. Reason: just update

  2. #2
    Member
    Real Name
    Garry M Flanigan
    Join Date
    Jul 2004
    Location
    Melbourne, Australia
    Posts
    909

    Default Re: How to get return code when runing stored procedures in Sql Server from XBasic

    The answers are all here.
    Read right to thru to Post #11.
    Good luck!

  3. #3
    Member
    Real Name
    Javier Martinez-Gomez
    Join Date
    Aug 2013
    Posts
    3

    Default Re: How to get return code when runing stored procedures in Sql Server from XBasic

    Hi Garry
    Thanks for your help, but what I want is to get the code I put with the return inside the stored procedure, not through the parametesr.

    I'm talking about @return in the next example:
    EXEC @return = storedProcedureName @par1,@par2

  4. #4
    Member
    Real Name
    Tom Birch Hansen
    Join Date
    Jan 2017
    Posts
    6

    Default Re: How to get return code when runing stored procedures in Sql Server from XBasic

    Hi Javier
    Did you ever find a solution to your problem?

    I've had the same problem, and I could not find a simple solution.

    However, I've managed to get the return value by making the SQL expression return a table / recordset with the returnvalue, as this example (using MS t-SQL ) demonstrates:

    Code:
    Dim SQL as c
    Dim conn as SQL::connection
    Dim args as SQL::Arguments
    Dim rs as SQL::ResultSet
    Dim returnvalue as N
    
    
    args.add("projectno","751-00056")
    
    SQL ="set nocount on; DECLARE @ReturnValue int; EXEC	@ReturnValue = [dbo].[TBH_LoadGGprojectToSloejfning] @projectno=:projectno;SELECT	'ReturnValue' = @ReturnValue"
    
    ' change connection string:
    if .not. conn.open("{.............................................}")
    	ui_msg_box("Error", conn.CallResult.text)
    	'end
    	end if
    
    flag = conn.execute(SQL, args)
    
    
    if .not. conn.execute(sql, args)
        ui_msg_box("Error", conn.CallResult.text)
        'end
    end if
    
    
    'sql_resultset_preview(conn.ResultSet)
    rs=Conn.ResultSet
    rs.NextRow()
    ui_msg_box("returnvalue is", rs.data("Returnvalue"))
    
    returnvalue=rs.data("Returnvalue")
    
    ui_msg_box("returnvalue is ", returnvalue)
    
    conn.close()
    rs.close()
    I don't know if something similar is possible for other database systems

Similar Threads

  1. Replies: 0
    Last Post: 11-23-2009, 11:35 PM
  2. Using Stored Procedures
    By sparkey in forum Alpha Five Version 9 - Desktop Applications
    Replies: 6
    Last Post: 03-27-2008, 12:07 PM
  3. Stored Procedures
    By gregz in forum Application Server Version 8
    Replies: 0
    Last Post: 06-08-2007, 07:12 PM
  4. Replies: 4
    Last Post: 10-25-2006, 10:53 AM
  5. MS SQL Stored Procedures
    By Brett in forum Web Application Server v7
    Replies: 11
    Last Post: 01-19-2006, 10:32 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •