http://www.tc5u.com/cpp/xg-1730729.htm
用DBGridEh吧,只要设置属性alopAppendEh为false即可
最简单将DBGrid的option属性中goEditing设置为false,禁止DBGrid编辑
将datasource指向的table或query改readonly成true
void __fastcall TForm1::Table1BeforeInsert(TDataSet *DataSet)
{
Abort();
}
procedure TFormLOrder.DBGridLOrderKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (Key = VK_DOWN) or (Key = VK_TAB) then
if DBGridLOrder.DataSource.DataSet.RecNo =
DBGridLOrder.DataSource.DataSet.RecordCount then
Key := 0;
end;
http://bbs.csdn.net/topics/20441300
移动到最后一条记录时再按一下“下”就会追加一条记录,如果去掉这项功能
procedure TForm1.DataSource1Change(Sender: TObject; Field: TField);
begin
if TDataSource(Sender).DataSet.Eof then TDataSource(Sender).DataSet.Cancel;
end;