Table operation errors
An error code is returned from each of the table operations that can be performed. The possible error codes are contained in the TableError enumeration. Many of the errors included in the enumeration will not occur in the released versions of Microsoft Dynamics GP. The following table describes the error values that your Visual Studio Tools integration is likely to encounter:
Constant |
Description |
---|---|
Changed |
The row being saved was changed by another user. |
DatabasePermissionViolation |
The current user does not have security privileges to access the table. |
DoubleLock |
A row was already locked in the table buffer. |
Duplicate |
The row being saved already exists in the table. |
EndOfTable |
The row cannot be retrieved because the beginning or end of the table has been reached. |
InvalidKeyNumber |
The table does not have a key with the number specified. |
NoError |
No error occurred. |
NoLock |
An operation such as Remove() was performed, but no row had been locked. |
NotFound |
The row was not found in the table. |
NotSupported |
The table operation is not supported for the table. For example, attempting to actively lock a row on a table that doesn't allow it. |
Sharing |
The row is actively locked by another user. |
TooManyOpenTables |
Too many tables are open in the application. |
Unknown |
An unknown error occurred. |
Typically, your code will do one or both of the following after each table operation:
- Check for the NoError value, indicating the table operation was successful. If the operation was successful, the next processing step can continue.
- Check for a specific error, such as NotFound. The code must respond appropriately, such as displaying a message for the user.
If an unexpected error occurs after performing a table operation, it's always a good idea to display the details of the error to the user. Include information such as the table, the operation being performed, and the error that occurred.
Warning: When a table operation error occurs, your code won't follow the typical code path. Be sure that your code closes any tables it has accessed. Otherwise, the user won't be able to exit Microsoft Dynamics GP.