• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 988
  • Last Modified:

Edit DBGrid but prevent Insert and Delete

I need to edit the data in a DBGrid, so I must set the dgEditing property to true but I would like to prevent the user from Deleting or Inserting new rows.
0
gianluca
Asked:
gianluca
1 Solution
 
rwilson032697Commented:
You can provide handlers for the BeforeInsert and BeforeDelete events in the table (or query), like this:

procedure TMyForm.Table1BeforeInsert(DataSet: TDataSet);

begin
  if (we don't want to allow insert) then
    Abort;
end;

And the same for the delete event...

Cheers,

Raymond.
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now