我正在開發一個信息系統,這裏是我更新的語法,它沒有顯示錯誤,但它不更新我的表。任何人都可以幫忙解決這件事? 順便說一句,我使用的是2010 VB.Net和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][email protected],[LotNumber][email protected],[LotArea][email protected],[DateOfAward][email protected],[DateDueForFullPayment][email protected],[PurchasePrice][email protected],[ReAppraisedValue][email protected],[AmountDue][email protected],[TotalAmountPaid][email protected],[AmountUnpaid][email protected],[PropertyRemarks][email protected] WHERE [PropertyID][email protected] ", 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
可能是* this *代碼或*方法/函數*未被調用和執行。 – adatapost
感謝您的回覆,但我確定我打電話給他。因爲這個,我真的很難過。 – Kosmo
刪除所有try..catch語句,看看會發生什麼?請發佈*異常/錯誤*描述。請包括* event *處理程序定義(button_click或類似的東西)。 – adatapost