title: Difference between adding parameters to stored procedure in SQL Server?
body: <p>I would like to know the difference between these 2 notations. </p>
  
  <p>First of all I have a stored procedure</p>
  
  <pre><code>CREATE PROCEDURE AddSomething( @zonename varchar(50), @desc varchar(255), @TheNewId int OUTPUT ) AS 
  BEGIN 
     INSERT INTO a_zone(zonename, descr) VALUES(@zonename, @desc) 
     SELECT @TheNewId = SCOPE_IDENTITY()         
  END
  </code></pre>
  
  <p>What is the difference if I add parameters in this manner</p>
  
  <pre><code>SqlCommand Cmd = new SqlCommand("AddSomething", oConn); 
  Cmd.CommandType = CommandType.StoredProcedure; 
  SqlParameter oParam1 = Cmd.Parameters.AddWithValue("@zonename", sName);
  SqlParameter oParam2 = Cmd.Parameters.AddWithValue("@desc", description);
  </code></pre>
  
  <p>and</p>
  
  <pre><code>SqlCommand Cmd2 = new SqlCommand("AddSomething", oConn); 
  Cmd2.CommandType = CommandType.StoredProcedure;
  cmd2.Parameters.Add("@zonename", SqlDbType.VarChar).Value = zonename.Text.Trim();
  cmd2.Parameters.Add("@desc", SqlDbType.VarChar).Value = desc.Text.Trim();
  </code></pre>