title: How to retrieve the result value and a select statement of a stored procedure at the same time in C#?
body: <p>OK so this might sound a bit weird!<br>
  The thing is that in a project there are many stored procedure already written like this:  </p>
  
  <pre><code>CREATE PROCEDURE [Status_Insert]
  
          @StatusId       int OUTPUT,
          @Status         nvarchar (50),
          @IsDeleted      bit = 0
  
  AS
  
  SET NOCOUNT ON;
  
  BEGIN TRY
  BEGIN TRAN
  
  INSERT INTO dbo.[Status]
  (
          [Status],
          [IsDeleted]
  )
  VALUES
  (
          @Status,
          @IsDeleted
  )
  
  SET @StatusId = @@IDENTITY
  
  COMMIT TRAN
  RETURN 1
  END TRY
  
  BEGIN CATCH
  ROLLBACK TRAN
  
  DECLARE @ErrorNumber_INT INT;
  DECLARE @ErrorSeverity_INT INT;
  DECLARE @ErrorProcedure_VC VARCHAR(200);
  DECLARE @ErrorLine_INT INT;
  DECLARE @ErrorMessage_NVC NVARCHAR(4000);
  
  SELECT
          @ErrorMessage_NVC = ERROR_MESSAGE(),
          @ErrorSeverity_INT = ERROR_SEVERITY(),
          @ErrorNumber_INT = ERROR_NUMBER(),
          @ErrorProcedure_VC = ERROR_PROCEDURE(),
          @ErrorLine_INT = ERROR_LINE()
  
  RETURN -1
  END CATCH
  </code></pre>
  
  <p>The primary key is an <code>Identity</code> and an output variable is used to retrieve its value after the insert statement. (By the way, is this approach a good practice?)<br>
  Now the return values are used to indicate the success or failure of the procedure. (IE.  if the operation was successful 1 is returned and -1 is returned if the operation has failed)
  If there is an error in the execution of the procedure, the last select statement will return the error to the user.</p>
  
  <p>Now how can I call this procedure in C# and get these results at the same time?
  What I want to do is, execute the procedure, and get the return value, if it was 1 then get the result of the last select statement (which contains more info about the error that has occured)
  Thanks in advance.</p>