VistaDB 6
VistaDB / Developer's Guide / How To Perform Common Tasks / How To - Handle SQL and VistaDB Exceptions
In This Topic
    How To - Handle SQL and VistaDB Exceptions
    In This Topic

    Exceptions are part of ADO.NET 

    A key concept to all ADO.NET providers is that you must handle exceptions. Exceptions are the key to trapping error conditions. Most errors will throw an exception rather than a return value.

    VistaDB throws two types of exceptions: VistaDBException and VistaDBSQLException

    VistaDB.Diagnostic.VistaDBException

    DBException is the general exception class (SQL Exceptions are derived from this class). Trapping this exception will let you know when you have hit an error in VistaDB. It will not trap general system exceptions though.

    Use ex.Contains() for checking if any of the nested errors contain a specific error event ID.

    See the bad password checking page for more information.

    VistaDB.Diagnostic.VistaDBSQLException

    SQL Exceptions are for SQL parsing problems.
    The LineNo and ColumnNo fields allow you to find the exact spot in the SQL code with the problem. This is how the Data Builder shows the error messages.

    DbException (base exception class)

    All of our exceptions inherit from the DbException class. You can trap this exception generically if you are not bound against our provider and lookup the errors using the InnerException, and Data properties.

    Error numbers and their meanings

    Look in the API reference under the VistaDB.Diagnostic.Errors Class. There are hundreds of possible error messages.  In cases where you are looking for a specific type of error that you want to apply special handling to you can use the members of this class.

    See Also