title: ADO.NET - The Size property has an invalid size of 0
body: <p>I'm trying to get output value from DB via ADO.NET. There's a client code:  </p>
  
  <pre><code>    using (var connection = new SqlConnection(ConnectionString))
      {
          connection.Open();
          SqlCommand command = new SqlCommand("pDoSomethingParamsRes", connection);
          command.CommandType = CommandType.StoredProcedure;
          command.Parameters.Add("@i", 1);
          var outParam = new SqlParameter("@out", SqlDbType.VarChar);
          outParam.Direction = ParameterDirection.Output;
          command.Parameters.Add(outParam);
          command.ExecuteNonQuery();
          Console.WriteLine(command.Parameters["@out"].Value.ToString());
      }
  </code></pre>
  
  <p>When I run this I get the following exception:</p>
  
  <pre><code>the Size property has an invalid size of 0
  </code></pre>
  
  <p>According to manual <a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlparameter.size.aspx" rel="nofollow noreferrer">SqlParameter.Size Property</a> I might omit size. Why do I get this exception?</p>
  
  <p>How to make it work without passing size?  </p>