我正在使用以下代碼更新oracle中的表。它執行但更新不提交。如果我用Oracle SQL Developer運行查詢,它可以正常工作。我錯過了什麼? SELECT語句按預期工作。OracleCommand更新不提交更改
`昏暗BillOfLadingNumber的String = txtBillOfLadingNumber.Text.Trim
Dim TrailerNumber As String = txtTrailerNumber.Text.Trim
Dim CarrierCode As String = txtCarrierCode.Text.Trim
Dim TransportationMethod As String = txtTransportationMethod.Text.Trim
Dim OracleCommand As New OracleCommand()
With OracleCommand
.Connection = OracleConnection
.CommandType = CommandType.Text
.CommandText = "UPDATE XXF_ASN_HEADERS SET BILL_OF_LADING_NUMBER ='" + BillOfLadingNumber + "',TRAILER_NUMBER ='" + TrailerNumber + "',CARRIER_CODE ='" + CarrierCode + "',TRANSPORTATION_METHOD ='" + TransportationMethod + "' WHERE HEADERID ='" + Request.QueryString("HeaderId") + "'"
End With
OracleConnection.Open()
Dim result As Integer = OracleCommand.ExecuteNonQuery()
OracleConnection.Close()
If result = 1 Then Response.Redirect("default.aspx")`
解決方案的不一部分,但你確實應該使用參數 – 2010-10-11 16:05:34
是否有未提交的事務,範圍是什麼? – 2010-10-11 16:08:13
是的,使用OracleTransaction對象是主鍵。謝謝你們。 – 2010-10-12 03:15:05