title: Changing the ParameterDirection.Input to ParameterDirection.InputOutput
body: <pre><code>MemberChecker.CommandType = CommandType.StoredProcedure;
  </code></pre>
  
  <p>added
  <strong>and Problem Solved!</strong></p>
  
  <p>---- Here was the funny question!</p>
  
  <p>Why does my SqlCommand accessing a Stored Procedure work only when I use</p>
  
  <pre><code>ParameterDirection.InputOutput
  </code></pre>
  
  <p>and not</p>
  
  <pre><code>ParameterDirection.Output
  </code></pre>
  
  <p><strong>An SqlParameter with ParameterName '@Customer' is not contained by this SqlParameterCollection</strong></p>
  
  <p>Here is some of my code:</p>
  
  <pre><code>        using (SqlConnection H20_Connection = new SqlConnection(ConfigurationManager.ConnectionStrings["H20"].ConnectionString))
          {
              SqlCommand MemberChecker = new SqlCommand("execute custom_x_Check", H20_Connection);
              MemberChecker.Parameters.Add("@TN", SqlDbType.VarChar,50).Value = TNH20.Text.Trim();
              MemberChecker.Parameters.Add("@Customer_ID", SqlDbType.VarChar, 50).Value = TNH20.Text.Trim();
  
              MemberChecker.Parameters.Add("@Customer", SqlDbType.VarChar, 100).Direction = ParameterDirection.Output;
              MemberChecker.Parameters.Add("@Out_TN", SqlDbType.VarChar, 50).Direction = ParameterDirection.Output;
              MemberChecker.Parameters.Add("@Out_Customer_ID", SqlDbType.VarChar, 50).Direction = ParameterDirection.Output;
              H20_Connection.Open();
              if (MemberChecker.ExecuteNonQuery() &gt; 1)
              {
                  Top.Visible = false;
                  Bottom.Visible = true;
              }
              else
              {
                  Top.Visible = true;
                  Bottom.Visible = false;
              }
          }
  </code></pre>
  
  <p>and my SQL</p>
  
  <pre><code>alter proc custom_Check
  
  @TN varchar(50) ='',
  @Customer_ID varchar(50)='',
  @Customer varchar(100) out,
  @Out_TN varchar(50) out,
  @Out_Customer_ID varchar(50) out
  
  as
  
  select @Out_Customer_ID=Customer_ID,
  @Out_TN = MainTN,@Customer = Customer
   from [vCustomerName]
  where Customer_ID  = @Customer_ID or @TN = MainTN
  </code></pre>
  
  <p>Thanks!</p>