VistaDB 6
VistaDB / Developer's Guide / How To Perform Common Tasks / Handle SQL and VistaDB Exceptions / Load exception Data extended information
In This Topic
    Load exception Data extended information
    In This Topic

    All VistaDB Exceptions derive from DbException. This exception contains a dictionary property named Data which are Key/Value pairs of extended information about the error. These are not set in all exceptions, but can be very useful in some situations.

    Walk the KeyValue data in an exception

    Catch Errors
    Copy Code
    catch( VistaDBException vex )
    {
        if (vex.ErrorId == VistaDB.Diagnostic.Errors.dda_StringExceedMaximum)
        {
            foreach ( DictionaryEntry de in currentException.Data)
            {
                Console.WriteLine(de.Key);
                Console.WriteLine(de.Value);
            }
        }
    }
    

    For the error code dda_StringExceedMaximum the following Keys are set to give extended information about the error:

    Column - The name of the column that data was attempting to be assigned
    Value - The value that was being assigned to the column
    SqlRow - The row of the SQL Statement that the error occurred. Note this is relative to the start of the current batch or function. It does not include headers or comment lines.