Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Where is a list of ADODB error codes?
Message
De
05/09/2001 15:16:39
 
 
À
05/09/2001 13:59:14
GW Gross
{Banned by Information Security Policy}
Lake Mary, Floride, États-Unis
Information générale
Forum:
Visual Basic
Catégorie:
Bases de données DAO/RDO/ODBC/ADO
Divers
Thread ID:
00552695
Message ID:
00552751
Vues:
23
This message has been marked as a message which has helped to the initial question of the thread.
NativeError and SQLState would depend on your provider. For SQL Server, check out the books online if you have it available or if not check this link on MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/trblsql/tr_errorformats_2skz.asp?frame=true
Synchronize the table of contents after loading this page, so you can see the additional links on the tree on the left.
HTH

>I am trying to enhance my error handling abilites with ADODB. I have found references that taught me how to loop thourgh and read the ADODB.Error collection. I even managed to write a generic procedure that loops through the Error collection for any ADO connection without needing to know its name. (I put the code below).
>
>Here are the questions: I am currently using Access 97 and Access 2000, but I want to also be able to handle MSDE and SQL Server 7. Where can I find a list of the SQLState values that are returned? Where can I find a list of the Number and Descriptions that are returned? What is the NativeError value?
>
>I have searched the MS site and the ADO site and cannot find a reference.
>
>Any help would be appreciated. Also any advice on improving the error handling code would also be appreciated.
>
>Generic ADO Error Collection Procedure:
>
>
>Public Sub gAppADOErroCollection(ByRef strDBName As String, _
>                                       errErrorCollection As Variant)
>
>    'ADO Error Information
>    Dim errLoop As Error
>    Dim strError As String
>    Dim iCounter As Integer
>
>    'In case our adoConnection is not set or
>    'there are other connection problems
>    On Error Resume Next
>
>        iCounter = 1
>        strError = vbNullString
>
>        'List the connection name in a header
>        'This statement can be changed to write to an error log or
>        'a list box.
>        Debug.Print strDBName & " Errors"
>
>        For Each errLoop In errErrorCollection
>
>            With errLoop
>
>                'Construct an error message string
>                strError = "Error #" & iCounter & vbCrLf
>                strError = strError & "ADO Error #" & .Number & vbCrLf
>                strError = strError & "Description " & .Description & vbCrLf
>                strError = strError & "Source " & .Source & vbCrLf
>                strError = strError & "SQLState " & .SQLState & vbCrLf
>                strError = strError & "NativeError " & .NativeError & vbCrLf
>                Debug.Print strError
>                iCounter = iCounter + 1
>
>                'Code to handle a specific error.
>                'This is where I want to put a Case statement
>                'to handle more by raising specific errors
>                'depending on what error was found.
>                If .SQLState = "3022" Then
>                    Debug.Print "Duplicate Key in SPOT"
>                    Resume Next
>                End If
>
>            End With
>        Next
>
>
>End Sub
>
>
>Thanks,
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform