Dim strConnectionString As String = "provider=microsoft.ACE.OLEDB.12.0;DATA SOURCE=C:\BDSM\StoresDB.accdb;" Using accConnection As New OleDb.OleDbConnection(strConnectionString) Using cmd As New OleDb.OleDbCommand("UPDATE [Stocks] SET Quantity= Quantity - @QuantitySold,TotalCost=TotalCost - @SalesCost where [StockCode]=@Param1 ", accConnection) cmd.Parameters.AddWithValue("@QuantitySold", row.Cells("Quantity").Value) cmd.Parameters.AddWithValue("@SalesCost", row.Cells("TotalCost").Value) cmd.Parameters.AddWithValue("@Param1", row.Cells("StockCode").Value) accConnection.Open() Dim intUpdate As Integer = cmd.ExecuteNonQuery() accConnection.Close() End Using End Using Next
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)