May be because your query has syntax errors-
cmd = new OleDbCommand(""update InvoiceItems set Quantity = '" + txtQty.Text +"';,UOM = '" + txtUOM.Text + "',UnitPrice ='" + txtUnitPrice.Text + "',GrossAmount ='" + txtGrossAmount.Text + "',VAT = '" + txtVAT.Text + "',VatAmount ='" + txtVatAmount.Text + "',Total ='" + txtTotal.Text + "' where InvoiceItemId = " + txtInvoiceNo.Text + "", conn);
--
""update..
should be
"update..
--
Quantity = '" + txtQty.Text +"';,
, no semicolon required here and if it's a numeric datatype column single quote also not required, so should be
Quantity = " + txtQty.Text +",
-- Single quotes not required for other columns too like UnitPrice, GrossAmount, VatAmount , Total etc.
Very very important:
Your code is vulnerable to
SQLInjection[
^]
Please follow below links to learn how to prevent SQL Injection-
How To: Protect From SQL Injection in ASP.NET[
^]
SQL Injection Attack, its examples and Prevention mechanisms and Techniques in ASP.Net[
^]
Hope, it helps :)