⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addingnewrecords.htm

📁 Absolute Database 5.12 src. Absolute Database lets you forget the Borland Database Engine (BDE). Th
💻 HTM
字号:
<html>
<head>
   <title>Adding New Records</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>Adding New Records
<br>
</b></span>
    </td>
    <td align="right">
     <font face="Arial" size="2">
     <a href="creatingfilters.htm">Previous</a>&nbsp;
     <a href="overview.htm">Top</a>&nbsp;
     <a href="editingrecords.htm">Next</a>
     </font>
    </td>
  </tr>
</table>
<br><br>



<span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">
<br>
An active dataset must be in <i>dsInsert</i> mode before an application can add new records. In code, you can use the <a href=tdataset_insert.htm>Insert</a> or <a href=tdataset_append.htm>Append</a> methods to put a dataset into dsInsert mode if the read-only <a href=tdataset_canmodify.htm>CanModify</a> property for the dataset is True.
<br>

<br>
Once a dataset is in <i>dsInsert </i>mode, a user or application can enter values into the fields associated with the new record. Except for the grid and navigational controls, there is no visible difference to a user between <i>Insert</i> and <i>Append</i>. On a call to <i>Insert</i>, an empty row appears in a grid above what was the current record. On a call to <i>Append</i>, the grid is scrolled to the last record in the dataset, an empty row appears at the bottom of the grid, and the Next and Last buttons are dimmed on any navigator component associated with the dataset.
<br>

<br>
Data-aware controls for which inserting is enabled automatically call <a href=tdataset_post.htm>Post</a> when a user executes any action that changes which record is current (such as moving to a different record in a grid). Otherwise you must call <i>Post</i> in your code.
<br>
<i>Post</i> writes the new record to the database.
<br>

<br>
<b>Example:
<br>

<br>
</b><span style="font-family:Courier New; font-size:8pt; color:#000000"><b>with</b>&nbsp;ABSTable1&nbsp;<b>do</b>
<br>
<b>begin</b>
<br>
&nbsp;&nbsp;Insert;
<br>
&nbsp;&nbsp;FieldByName(<span style="font-family:Courier New; font-size:8pt; color:#000080">'FirstName'</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">).AsString&nbsp;:=&nbsp;<span style="font-family:Courier New; font-size:8pt; color:#000080">'John'</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">;
<br>
&nbsp;&nbsp;FieldByName(<span style="font-family:Courier New; font-size:8pt; color:#000080">'LastName'</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">).AsString&nbsp;:=&nbsp;<span style="font-family:Courier New; font-size:8pt; color:#000080">'Smith'</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">;
<br>
&nbsp;&nbsp;FieldByName(<span style="font-family:Courier New; font-size:8pt; color:#000080">'Salary'</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">).AsFloat&nbsp;:=&nbsp;<span style="font-family:Courier New; font-size:8pt; color:#000080">1999</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">.<span style="font-family:Courier New; font-size:8pt; color:#000080">95</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">;
<br>
&nbsp;&nbsp;Post;
<br>
<b>end</b>;</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">
<br>
</span></span>

<!--#include virtual="/inc/footer.php"--> 
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -