I need help with the following problem. I have implemented an editable DBGrid using the following component types: TQuery, TDataSource, TUpdateSQL, TDBGrid. The Query AfterPost event handler applies the changes to the database.
procedure TCardForm.Query2AfterPost(DataSet: TDataSet);
begin
Query2.ApplyUpdates;
end;
So if I edit a row in the DBGrid and move to another row or press the down arrow key the changes I have made are applied to the database. Everything works fine with one exception. When an incorrect value is entered, a database exception is thrown and a message is shown, for example "Column ... cannot be NULL". After clicking OK in the message box the application allows me to browse the DBGrid and to go to another row without trying to apply the changes and without showing the exception message again. It shows the exception message only if I edit another row or edit the same row again. I don't want the application to allow me to do that. I want moving to another row in the DBGrid to be impossible until entering a correct value.
Thanks in advance for your answers!