// 点击“保存”触发事件
1 Long ll_row
2
3 // 将控件“数据对象”的编辑值存入缓存区等待验证
4 IF dw_1.AcceptText() = -1 Then Return -1
5 // 待处理状态
6 IF dw_1.Of_UpdatesPending() = 0 Then Return 0
7
8
9 For ll_row = 1 To dw_1.rowcount()
10 // 依次检查每行中的列是否存在空值,存在即阻止保存并弹出对应提醒
11 IF dw_1.of_Validation(ll_Row,{"file_path",'catalog','file_name'}) = -1 Then
12 Return -1
13 End IF
14 // 新增行或行有修改时,更新“时间”和“用户”字段
15 IF dw_1.GetItemStatus(ll_Row,0,Primary!) = New! Or &
16 dw_1.GetItemStatus(ll_Row,0,Primary!) = NewModified! Then
17
18 dw_1.Object.trans_date[ll_Row] = gf_Get_SysDateTime()
19 dw_1.Object.trans_user[ll_Row] = gs_empname
20 End IF
21 // // 系统检索行或列没有任何修改
22 // IF dw_1.GetItemStatus(ll_Row,0,Primary!) <> NotModified! Then
23 // dw_1.Object.trans_date[ll_Row] = gf_Get_SysDateTime()
24 // dw_1.Object.trans_user[ll_Row] = gs_empname
25 // End IF
26
27 End For
28 // 数据窗口更新表
29 IF dw_1.Update(True,False) = -1 Then
30 Rollback;
31 MessageBox("提示","数据保存出现错误~r~n"+dw_1.Of_GetDBError(),StopSign!,OK!)
32 Return -1
33 End IF
34 // 提交
35 Commit;
36 // 清除缓存
37 dw_1.ReSetUpdate()
38 MessageBox("提示","数据保存成功!")
39 Return 1