title: i want to subtract a value from a table while adding those value in another table
body: <p>I am creating a GRN application using winforms.  I have 2 tables.</p>
  
  <p>Table 1:  In hand stock<br />
  Table 2:  Sales</p>
  
  <p>How can I subtract in hand stock from Quantity after a sale.    This is my code for data base inserting.  While adding these I want to subtract. </p>
  
  <pre><code>String SQL = "insert into Items_Sold values('" 
              + myobj.Invoiceno + "','"
              + myobj.Itemcode + "','"
              + myobj.Category + "','"
              + myobj.Itemname + "','" 
              + myobj.Qty + "','" 
              + myobj.Unitprice + "',' " 
              + myobj.Subtotal + "')";
  
          DBConnection mycon = new DBConnection();
          mycon.insertValues(SQL);
  </code></pre>
  
  <p>I tried </p>
  
  <pre><code> {
          string SQL = "Update Stock Set Invoiceno='"
              + textBox_InvoiceNo.Text.Trim() + "', "
              + "Quantity='" + textBox_Qty.Text.Trim() + "',"
  
          DBConnection database = new DBConnection();
          int rslt = database.updatetValues(SQL);
  
          if (rslt &gt; 0)
          {
              MessageBox.Show("Updated");
          }
          else
          {
              MessageBox.Show("Faild");
          }
      }
  </code></pre>
  
  <p>This is updating my database with new data.</p>