title: C# error : Input string was not in a correct format
body: <p>I was getting this error: "Input string was not in a correct format."</p>
  
  <p>Here is my Code:</p>
  
  <pre><code>    private void UpdatePOdetailBalance(int Qty)
      {
          int newbal;
  
          SqlCommand com = new SqlCommand();
  
          com.Connection = cn;
  
          newbal = Convert.ToInt16(txtQtyOrdered.Text) - Qty;
          com.CommandText =
              "UPDATE PODetail SET BalanceQty="+ newbal +" WHERE OrderID=" +
               Convert.ToInt16(txtPONumber.Text) + "AND ItemID=" +
               Convert.ToInt16(txtItemNo.Text);
  
  
          com.ExecuteNonQuery();
  
      }
  
      private void btnOK_Click(object sender, EventArgs e)
      {
  
              UpdatePOdetailBalance(Convert.ToInt16(txtQuantity.Text));
  
      }
  </code></pre>
  
  <p>I want to compute the newbal which is equal to txtQtyOrdered minus Qty but i'm getting this error please help me with this. Thanks.</p>