I'm working on an information system and here's my syntax for update, it shows no errors, but it does not update my table. Anyone can help on this matter? By the way, I'm using VB.Net 2010 and MS Access 2007.
Try
Dim conn As New OleDbConnection(gConnectionString)
If conn.State = ConnectionState.Closed Then
conn.Open()
End If
Try
Dim comm As New OleDbCommand( "UPDATE PropertiesPayors SET [PayorName]=@PayorName,[LotNumber]=@LotNumber,[LotArea]=@LotArea,[DateOfAward]=@DateOfAward,[DateDueForFullPayment]=@DateDueForFullPayment,[PurchasePrice]=@PurchasePrice,[ReAppraisedValue]=@ReAppraisedValue,[AmountDue]=@AmountDue,[TotalAmountPaid]=@TotalAmountPaid,[AmountUnpaid]=@AmountUnpaid,[PropertyRemarks]=@PropertyRemarks WHERE [PropertyID]=@PropertyPayorID ", conn)
With comm
With .Parameters
.AddWithValue("@PropertyPropertyID", Val(propertyPayorSessionID.ToString))
.AddWithValue("@PayorName", txtPayorName.Text)
.AddWithValue("@LotNumber", txtLotNumber.Text)
.AddWithValue("@LotArea", Val(txtLotArea.Text))
.AddWithValue("@DateOfAward", txtDateOfAward.Text.ToString)
.AddWithValue("@DateDueForFullPayment", txtDateOfFullPayment.Text.ToString)
.AddWithValue("@PurchasePrice", Val(txtPurchasePrice.Text))
.AddWithValue("@ReAppraisedValue", Val(txtReAppraisedValue.Text))
.AddWithValue("@AmountDue", Val(txtAmountDue.Text))
.AddWithValue("@TotalAmountPaid", Val(txtTotalAmountPaid.Text))
.AddWithValue("@AmountUnpaid", Val(txtAmountUnpaid.Text))
.AddWithValue("@PropertyRemarks", txtRemarks.Text)
End With
.ExecuteNonQuery()
End With
msg = MsgBox("Record Updated.", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Update Payor")
Catch myError As Exception
MsgBox("Error: " & myError.Message, MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "Query Error")
End Try
Catch myError As Exception
MsgBox("Error: " & myError.Message, MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "Connection Error")
End Try