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 ) { if( uEx.NativeError == ULSQLCode.SQLE_MOBILINK_COMMUNICATIONS_ERROR ) { MessageBox.Show( "StreamErrorCode = " + _conn.SyncResult.StreamErrorCode.ToString() + "\r\n" + "StreamErrorParameters = " + _conn.SyncResult.StreamErrorParameters + "\r\n" + "StreamErrorSystem = " + _conn.SyncResult.StreamErrorSystem + "\r\n" ); } else { MessageBox.Show(uEx.Message); } } catch(System.Exception ex ) { MessageBox.Show(ex.Message); } } |
Discuss this page in DocCommentXchange.
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |