title: Ms Sql Stored Procedured select value
body: <p><strong>Stored Procedured:</strong></p>
  
  <pre><code>ALTER procedure [dbo].[StockEnumerationDetailGetFindProduct]
  
         @StockEnumerationMasterId BIGINT,
         @ProductId BIGINT
  
      as
  
  
      DECLARE @Remaining float
      DECLARE @WarehouseStock float
      DECLARE @WarehouseCode nvarchar(10)
  
  
  begin
  
      set @WarehouseCode= 
      (
      Select w.Code  from [dbo].StockEnumerationMaster as SEM
      INNER JOIN [dbo].Warehouses as w on w.[Id]=SEM.WarehouseId
      where
      SEM.Id=@StockEnumerationMasterId)
  
      set @WarehouseStock=dbo.FncWareHouseStockControl(@WarehouseCode,@ProductId)
  
  
  
      select @WarehouseStock
  
  end
  </code></pre>
  
  <p>Select @WarehouseStock does not work in code side.</p>
  
  <p><strong>My Code :</strong></p>
  
  <pre><code> public IList&lt;FormEnumerationDetailModel&gt; StockEnumerationDetailGetFindProduct(long stockEnumerationMasterId, long productId)
          {
              using (var connection = new SqlConnection(Properties.Resources.ConnectionString))
              {
                  var command = new SqlCommand(Properties.Resources.StockEnumerationDetailGetFindProduct, connection);
                  var formEnumerationDetailModel = new List&lt;FormEnumerationDetailModel&gt;();
                  command.CommandType = CommandType.StoredProcedure;
                  command.Parameters.AddWithValue("@StockEnumerationMasterId", stockEnumerationMasterId);
                  command.Parameters.AddWithValue("@ProductId", productId);
                  try
                  {
                      connection.Open();
                      var reader = command.ExecuteReader();
                      while (reader.Read())
                      {
                          formEnumerationDetailModel.Add(new FormEnumerationDetailModel()
                          {
                              Unit = float.Parse(reader["WarehouseStock"].ToString())
                          });
                      }
                      connection.Close();
                      return formEnumerationDetailModel;
                  }
                  catch (Exception e)
                  {
                      return new List&lt;FormEnumerationDetailModel&gt;();
                  }
              }
              return new List&lt;FormEnumerationDetailModel&gt;();
          }
  </code></pre>
  
  <p><strong>Exception :</strong> </p>
  
  <p>{"WarehouseStock"}</p>
  
  <p>Why exception just displays me "{"WarehouseStock"}" ?</p>
  
  <p>If i run Stored procedured on ms sql it works.</p>
  
  <p>However if i run stored procedured on code side it gives "{"WarehouseStock"}" exception.</p>
  
  <p>Where i miss exactly ?</p>
  
  <p><strong>Any help will be appreciated.</strong></p>
  
  <p><strong>Thanks.</strong></p>