Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> ADO error handling

ADO error handling

From: Jimbo <invalid_at_invalid.spam>
Date: Thu, 05 Dec 2002 15:23:43 +0000
Message-ID: <plruuuo0suic76e2r8a8h1omkq956ej2ma@4ax.com>


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)) & "'),"
strSQL = strSQL & "upper('" & UCase(Trim(Text1.Text)) & "'),upper('" & cboType.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

   Next

End Sub Received on Thu Dec 05 2002 - 09:23:43 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US