私は情報システムに取り組んでおり、更新の構文は次のとおりです。エラーは表示されませんが、テーブルは更新されません。誰でもこの問題について助けることができますか? ちなみに、VB.Net 2010 と 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