📄 errorcodes.htm
字号:
<html>
<head>
<title>Error Codes</title>
</head>
<!--#include virtual="/inc/header.php"-->
<table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="#FFFFFF">
<tr>
<td align="left">
<span style="font-family:Helvetica,Arial; font-size:12pt; color:#000000"><b>Error Codes
<br>
</b></span>
</td>
<td align="right">
<font face="Arial" size="2">
<a href="supporteddatatypes.htm">Previous</a>
<a href="overview.htm">Top</a>
<a href="reservedwords.htm">Next</a>
</font>
</td>
</tr>
</table>
<br><br>
<span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">
<br>
Here is the list of error codes which could be useful to handle errors and to provide user with the proper error message.
<br>
You can see a practical example of errors handling in the MultiUser demo supplied with the Absolute DB.
<br>
<br>
<span style="font-family:Courier New; font-size:8pt; color:#000000"> <span style="font-family:Courier New; font-size:8pt; color:#000080"><i>// error codes</i></span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">
<br>
<b>const</b> ABS_ERR_OK = <span style="font-family:Courier New; font-size:8pt; color:#000080">0</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">;
<br>
<b>const</b> ABS_ERR_INSERT_RECORD = -<span style="font-family:Courier New; font-size:8pt; color:#000080">1</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">;
<br>
<b>const</b> ABS_ERR_UPDATE_RECORD = -<span style="font-family:Courier New; font-size:8pt; color:#000080">2</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">;
<br>
<b>const</b> ABS_ERR_DELETE_RECORD = -<span style="font-family:Courier New; font-size:8pt; color:#000080">3</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">;
<br>
<b>const</b> ABS_ERR_UPDATE_RECORD_MODIFIED = -<span style="font-family:Courier New; font-size:8pt; color:#000080">4</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">;
<br>
<b>const</b> ABS_ERR_DELETE_RECORD_MODIFIED = -<span style="font-family:Courier New; font-size:8pt; color:#000080">5</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">;
<br>
<b>const</b> ABS_ERR_UPDATE_RECORD_DELETED = -<span style="font-family:Courier New; font-size:8pt; color:#000080">6</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">;
<br>
<b>const</b> ABS_ERR_DELETE_RECORD_DELETED = -<span style="font-family:Courier New; font-size:8pt; color:#000080">7</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">;
<br>
<br>
<b>const</b> ABS_ERR_CONSTRAINT_VIOLATED = -<span style="font-family:Courier New; font-size:8pt; color:#000080">8</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">;
<br>
<b>const</b> ABS_ERR_UPDATE_RECORD_PROHIBITED = -<span style="font-family:Courier New; font-size:8pt; color:#000080">9</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">;
<br>
<b>const</b> ABS_ERR_DELETE_RECORD_PROHIBITED = -<span style="font-family:Courier New; font-size:8pt; color:#000080">10</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">;
<br>
<b>const</b> ABS_ERR_CANCEL_PROHIBITED = -<span style="font-family:Courier New; font-size:8pt; color:#000080">11</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">;
<br>
<br>
<b>const</b> ABS_ERR_RECORD_LOCKED = -<span style="font-family:Courier New; font-size:8pt; color:#000080">12</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">;
<br>
<b>const</b> ABS_ERR_TABLE_LOCKED = -<span style="font-family:Courier New; font-size:8pt; color:#000080">13</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">;
<br>
<br>
<br>
</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000"><b>Example:</b>
<br>
<br>
</span><span style="font-family:Courier New; font-size:8pt; color:#000000"><b>procedure</b> TMainForm.ABSTable1DeleteError(DataSet: TDataSet;
<br>
E: EDatabaseError; <b>var</b> Action: TDataAction);
<br>
<b>begin</b>
<br>
Action:=daAbort;
<br>
<b>if</b> (E <b>is</b> EABSEngineError) <b>then</b>
<br>
<b>case</b> (EABSEngineError(E).ErrorCode) <b>of</b>
<br>
ABS_ERR_RECORD_LOCKED:
<br>
<b>begin</b>
<br>
<b>if</b> MessageDlg(<span style="font-family:Courier New; font-size:8pt; color:#000080">'The record is locked. '</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">+
<br>
<span style="font-family:Courier New; font-size:8pt; color:#000080">'Do you want to try to delete this record again?'</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">,
<br>
mtWarning,[mbYes,mbNo],<span style="font-family:Courier New; font-size:8pt; color:#000080">0</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">)=mrYes <b>then</b>
<br>
Action:=daRetry;
<br>
<b>end</b>;
<br>
ABS_ERR_TABLE_LOCKED:
<br>
<b>begin</b>
<br>
<b>if</b> MessageDlg(<span style="font-family:Courier New; font-size:8pt; color:#000080">'The table is locked. '</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">+
<br>
<span style="font-family:Courier New; font-size:8pt; color:#000080">'Do you want to try to delete this record again?'</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">,
<br>
mtWarning,[mbYes,mbNo],<span style="font-family:Courier New; font-size:8pt; color:#000080">0</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">)=mrYes <b>then</b>
<br>
Action:=daRetry;
<br>
<b>end</b>;
<br>
ABS_ERR_DELETE_RECORD_MODIFIED:
<br>
<b>begin</b>
<br>
MessageDlg(<span style="font-family:Courier New; font-size:8pt; color:#000080">'The record you are trying to delete has been modified by another user. '</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">+
<br>
<span style="font-family:Courier New; font-size:8pt; color:#000080">'The table will now be refreshed. If you want to delete this record, try again.'</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">,
<br>
mtWarning,[mbOk],<span style="font-family:Courier New; font-size:8pt; color:#000080">0</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">);
<br>
DataSet.Refresh;
<br>
<b>end</b>;
<br>
ABS_ERR_DELETE_RECORD_DELETED:
<br>
<b>begin</b>
<br>
MessageDlg(<span style="font-family:Courier New; font-size:8pt; color:#000080">'The record you are trying to delete has been deleted by another user '</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">+
<br>
<span style="font-family:Courier New; font-size:8pt; color:#000080">'The table will now be refreshed'</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">,
<br>
mtWarning,[mbOk],<span style="font-family:Courier New; font-size:8pt; color:#000080">0</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">);
<br>
DataSet.Refresh;
<br>
<b>end</b>
<br>
<b>else</b>
<br>
MessageDlg(E.<b>Message</b>,mtError,[mbOK],<span style="font-family:Courier New; font-size:8pt; color:#000080">0</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">);
<br>
<b>end</b>
<br>
<b>else</b>
<br>
MessageDlg(E.<b>Message</b>,mtError,[mbOK],<span style="font-family:Courier New; font-size:8pt; color:#000080">0</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">);
<br>
<b>end</b>;</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">
<br>
<br>
</span></span>
<!--#include virtual="/inc/footer.php"-->
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -