Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » UltraLite - .NET Programming » UltraLite.NET application development


Error handling

You can use the standard .NET error-handling features to handle errors. Most UltraLite methods throw ULException errors. You can use ULException.NativeError to retrieve the ULSQLCode value assigned to this error. ULException has a Message property, which you can use to obtain a descriptive text of the error. ULSQLCode errors are negative numbers indicating the error type.

After synchronization, you can use the SyncResult property of the connection to obtain more detailed error information. For example, the following sample illustrates a possible technique for reporting errors that occur during synchronization:

public void Sync() {
    try {
        _conn.Synchronize( this );
        _inSync = false;
    catch( ULException uEx ) {
                "StreamErrorCode = " + 
                      _conn.SyncResult.StreamErrorCode.ToString() + "\r\n"
                    + "StreamErrorParameters = " + 
                      _conn.SyncResult.StreamErrorParameters + "\r\n"
                    + "StreamErrorSystem = " + 
                      _conn.SyncResult.StreamErrorSystem + "\r\n"
        else {
    catch(System.Exception ex ) {
 See also