Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> ADO error handling
Can anyone tell me why error handlers not catcthing oracle unique
contraint errors?
Dim dbConnection As New ADODB.Connection
Dim dbCommand As New ADODB.Command
Dim dbRecordset As New ADODB.Recordset
Dim strSQL As String ' SQL string
Dim Err As ADODB.Error
Dim strError As String
On Error GoTo ErrorHandler
strSQL = "" strSQL = strSQL & "" strSQL = "INSERT INTO PASS" strSQL = strSQL & " (pass_id,password,username,type)" strSQL = strSQL & " VALUES (autonum_password.nextval,Upper('" &UCase(Trim(Text2.Text)) & "'),"
dbConnection.Mode = adModeReadWrite
dbCommand.CommandText = strSQL
dbRecordset.LockType = adLockOptimistic
dbConnection.Open C_CONNECT_STRING
dbConnection.BeginTrans
dbCommand.ActiveConnection = dbConnection dbCommand.CommandType = adCmdText
dbCommand.Execute
dbConnection.CommitTrans
ErrorHandler:
For Each Err In dbConnection.Errors
MsgBox "Error #" & Err.Number & vbCr & _ " " & Err.Description & vbCr & _
" (Source: " & Err.Source & ")" & vbCr & _
" (SQL State: " & Err.SQLState & "), vbCritical, "Error"
Debug.Print strError
End Sub Received on Thu Dec 05 2002 - 09:23:43 CST
![]() |
![]() |