 <p>when you use <code>Convert.ToInt16</code> you will get this exception if <em>value does not consist of an optional sign followed by a sequence of digits (0 through 9)</em></p> <p>Do a validation for inputs before proceed like below. </p> <pre><code>int orderNo; if (int.TryParse(txtOrderNo.Text, out orderNo)) { DisplayOrder(orderNo); DisplayOrderDetails(orderNo); } </code></pre> <p>Side Note :</p> <p>don't share the <code>SqlConnection</code> create new instant when you need it and wrap it with using block like below </p> <pre><code>using (SqlConnection con = new SqlConnection(connectionString)) { } </code></pre> <p>Use SQL Parameters </p> <pre><code>cmdSelect.CommandText = "SELECT * FROM Orders WHERE OrderNo = @OrderNo"; cmdSelect.Parameters.AddWithValue("@OrderNo", nOrderNo); </code></pre>