title: The parameterized query expects the parameter which was not supplied c# SQL
body: <p>I am new in SQL and C# and I encountered this SQL error. </p>
  
  <blockquote>
    <p>The parameterized query '(@pid nvarchar(4000),@desc
    nvarchar(4000),@cat nvarchar(4000),@p' expects the parameter '@pid',
    which was not supplied.</p>
  </blockquote>
  
  <p>I really need help. Thanks!</p>
  
  <pre><code> public void InsertRecord()
      {
          SqlCommand cmd = new SqlCommand("INSERT INTO PRODUCTS VALUES (@pid, @desc, @cat, @price, @scode)", myCon);
          cmd.Parameters.AddWithValue("@pid", productID);
          cmd.Parameters.AddWithValue("@desc", description);
          cmd.Parameters.AddWithValue("@cat", category);
          cmd.Parameters.AddWithValue("@price", price);
          cmd.Parameters.AddWithValue("@scode", supplierCode);//corrected the "key codes"
  
          myCon.Open();
          cmd.ExecuteNonQuery();
          myCon.Close();//added these lines of codes
      }
  </code></pre>