📄 editingrecords.htm
字号:
<html>
<head>
<title>Editing 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>Editing Records
<br>
</b></span>
</td>
<td align="right">
<font face="Arial" size="2">
<a href="addingnewrecords.htm">Previous</a>
<a href="overview.htm">Top</a>
<a href="deletingrecords.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>dsEdit</i> mode before an application can modify records. In your code you can use the <a href=tdataset_edit.htm>Edit</a> method to put a dataset into dsEdit 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>dsEdit</i> mode, a user can modify the field values for the current record that appears in any data-aware controls on a form. Data-aware controls for which editing is enabled automatically call <a href=tdataset_post.htm>Post</a> when a user executes any action that changes the current record (such as moving to a different record in a grid).
<br>
If you have a navigator component on your form, users can cancel edits by clicking the navigator's Cancel button. Canceling edits returns a dataset to dsBrowse state.
<br>
<br>
In code, you must write or cancel edits by calling the appropriate methods. You write changes by calling <a href=tdataset_post.htm>Post</a>. You cancel them by calling <a href=tdataset_cancel.htm>Cancel</a>. In code, <i>Edit</i> and <i>Post </i>are often used together. For example,
<br>
<br>
<span style="font-family:Courier New; font-size:8pt; color:#000000"><b>with</b> ABSTable1 <b>do</b>
<br>
<b>begin</b>
<br>
Edit;
<br>
FieldValues[<span style="font-family:Courier New; font-size:8pt; color:#000080">'CustNo'</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">] := <span style="font-family:Courier New; font-size:8pt; color:#000080">1234</span></span><span style="font-family:Courier New; font-size:8pt; color:#000000">;
<br>
Post;
<br>
<b>end</b>;
<br>
</span><span style="font-family:Helvetica,Arial; font-size:10pt; color:#000000">
<br>
In the previous example, the first line of code places the dataset in <i>dsEdit</i> mode. The next line of code assigns the number 1234 to the <i>CustNo</i> field of the current record. Finally, the last line writes, or posts, the modified record. Posting writes the change back to the database.
<br>
</span></span>
<!--#include virtual="/inc/footer.php"-->
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -