——此文章摘自《Delphi 数据库开发经典案例解析》定价¥特价¥购买>> //取消操作 procedure TMainProduceBitBtnClick(Sender: TObject); begin datasourceDataSetCancel; //将插入删除修改和移动按钮打开 bitbtnEnabled:=true; bitbtnEnabled:=true; bitbtnEnabled:=true; bitbtnEnabled:=true; bitbtnEnabled:=true; bitbtnEnabled:=true; bitbtnEnabled:=true; //关闭保存和取消按钮的使能 bitbtnEnabled:=false; bitbtnEnabled:=false; //将两个浏览按钮使能关闭 bitbtnEnabled:=false; bitbtnEnabled:=false; //恢复dbgrid的选取功能 dbgridEnabled:=true; //恢复dbedit的只读属性 dbeditReadOnly:=true; dbeditReadOnly:=true; dbeditReadOnly:=true; dbeditReadOnly:=true; dbeditReadOnly:=true; dbmemoReadOnly:=true; dbmemoReadOnly:=true; //刷新数据 adoqueryActive:=false; adoqueryActive:=true; end; //删除记录 procedure TMainProduceBitBtnClick(Sender: TObject); begin if applicationMessageBox(确实删除该数据?删除MB_OKCANCEL)=ID_OK then datasourcedatasetdelete; end; procedure TMainProduceDataSourceDataChange(Sender: TObject;Field: TField); begin //设置列的宽度 dbgridColumns[]Width:=; dbgridColumns[]Width:=; dbgridColumns[]Width:=; dbgridColumns[]Width:=; dbgridColumns[]Width:=; end; [] [] [] [] [] [] [] |