How to acces a flag set in sql server into business logic
<pre><code>public int InsertCompanyDetailsInformation(int companyId, int bankId, int accountNo, string accountType)
        {
            int rowsAffected = -1;
            int returnValue;
            try
            {
                SqlConnection con = DBProvider.GetDbConnection();
                using (con)
                {
                    con.Open();
                    SqlCommand objCmd = new SqlCommand("dbo.sp_InsertCompanyDetailsInformation", con);
                    objCmd.CommandType = CommandType.StoredProcedure;
                    objCmd.Parameters.AddWithValue("@companyId", companyId);
                    objCmd.Parameters.AddWithValue("@bankId", bankId);
                    objCmd.Parameters.AddWithValue("@accountNo", accountNo);
                    objCmd.Parameters.AddWithValue("@accountType", accountType);
                    rowsAffected = objCmd.ExecuteNonQuery();
                    SqlParameter sqlParam = objCmd.Parameters.Add("@insert_flag", SqlDbType.Int);
                    objCmd.Parameters["@insert_flag"].Direction = ParameterDirection.ReturnValue;
                    returnValue = int.Parse(objCmd.Parameters["@insert_flag"].Value.ToString());
                    con.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return rowsAffected;
        }
</code></pre>

<p>and stored procedure</p>

<pre><code>USE [SGTime_Development]
GO
/****** Object:  StoredProcedure [dbo].[sp_InsertCompanyDetailsInformation]    Script Date: 01/04/2011 14:31:09 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[sp_InsertCompanyDetailsInformation]
(
@companyId int,
@bankId int,
@accountNo int,
@accountType varchar(50))
AS  
BEGIN  
     SET NOCOUNT ON;  
     declare @insert_flag  int;

      if not exists(select AccountNo from [Company_Account_Details] where AccountNo=@accountNo)
  begin
      INSERT INTO [Company_Account_Details]
     ( Company_Id,
      BankID,
      AccountNo,
      AccountType)
      values
      (@companyId,
      @bankId,
      @accountNo,
      @accountType)
      set @insert_flag=1;
      END
      else 
      begin
            set @insert_flag=-1;
      end 

     return @insert_flag;
     end
</code></pre>

<p>I am getting error in the code i want return returnValue in InsertCompanyDetailsInformation Please help how we can return returnValue</p>
