Tuesday, 15 February 2011

sql server - Procedure return codes don't work after EXEC on PHP -


I've written a process that gives a code after going through the code, using sqlsrv library to fetch data While I also have a PHP function, I am able to get the correct return code from SQL Server Management Studio, however, in PHP code, the returncode has not been updated with the actual return value.

  $ returncode = 10000; $ Process = "{AccountBulkChargeTest call (?,?,?,?)}" $ Params = array (array ($ username, SQLSRV_PARAM_IN), array ($ nonumber, SQLSRV_PARAM_IN), array ($ message, SQLSRV_PARAM_IN), array $ Returncode, SQLSRV_PARAM_OUT)); $ Stmt = sqlsrv_query ($ this-> db, $ process, $ params); Var_dump ($ returncode);  

It gives the following (no change, should be 1000:

  int (10000)  

However , Is running with SQL Server Management Studio in the same way: USE [Database] GO

  DECLARE @ Return_Value, @ ReturnCodeEtec @ Return_VALUE = [DBO]. [AccountBlank Chargestist] @ UserName = N 'Hello', @number = 1, @ messages: n'helo ', @ returncode = @ returncode output @ select as returncode n' returncode ' Recieve value '= @standard_mana go  

returns as return / return of 1000 and return value as 0;

My process is given below:

  ALTER process [dbo]. [AccountBlank Chargestist] (@ Username varchar (32), @nomber int, @ mesages wark (640), @ retncode integer output) Int = 20; if (@ViewLt; 25) BEGIN SET @ReturnCode = 1000; Update Login Set Balance = Balance - 0; Excel Account Dotter Connection 0, 0, 0, 0; Return; EAD if (@value & lt; 40) BEGIN SET @ReturnCode = 2000; Start from the end SET @ReturnCode = 3000; End and return;  

I do not want to delete the following lines to make it work but I should be able to call the process to be posted above:

  Login Set Balance = Balance - 0; Exxonic account attractantation 0, 0, 0, 0;  

To use the keyword to return the value of @Rurn_value to your stored procedure is required .

According to the MSDN document, you have to use the RETURN @ReturnCode style.


No comments:

Post a Comment