——此文章摘自《Delphi 数据库开发经典案例解析》定价¥特价¥购买>> //修改记录 procedure TDocuInputToolButtonClick(Sender: TObject); begin SetToolBar(true); datasourceDataSetEdit; //设置操作类型 op:=edit; end; //删除记录 procedure TDocuInputToolButtonClick(Sender: TObject); begin if applicationMessageBox(删除该条记录?财务管理系统MB_OKCANCEL)=IDOK then begin //先删除分录表记录再删除凭证记录 adocommandCommandText:=delete from 分录表 where 凭证编号=+dbeditText+; adocommandExecute; datasourceDataSetDelete; end; end; //首记录 procedure TDocuInputToolButtonClick(Sender: TObject); begin datasourceDataSetFirst; end; //上记录 procedure TDocuInputToolButtonClick(Sender: TObject); begin datasourceDataSetPrior; end; //下记录 procedure TDocuInputToolButtonClick(Sender: TObject); begin datasourceDataSetNext; end; //尾记录 procedure TDocuInputToolButtonClick(Sender: TObject); begin datasourceDataSetLast; end; procedure TDocuInputToolButtonClick(Sender: TObject); begin close; end; //保存记录 procedure TDocuInputToolButtonClick(Sender: TObject); begin if dbeditText<>dbeditText then showmessage(借贷双方不平衡请检查) else begin if op=insert then begin datasourceDataSetPost; opType(op); end; if op=edit then begin opType(op); datasourceDataSetPost; end; SetToolBar(false); //清除操作标识符 op:=; end; end; //取消操作 procedure TDocuInputToolButtonClick(Sender: TObject); begin datasourceDataSetCancel; SetToolBar(false); //清除操作标识符 op:=; end; [] [] [] |