DelphiFAQ Home Search:
General :: Programming :: Delphi :: Database
Database development with Delphi. Includes issues with BDE, ADO and InterBase.

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

This is the FULL list of all articles in this category.

Featured Article

Keep a dataset in dsInsert/dsEdit mode after validation fails

If you want to keep a dataset in dsInsert/dsEdit mode after a validation fails, but do not want to loose your input, use Abort in the BeforePost() event.

(If you would use Dataset.Cancel, you'd loose the input and return to browse mode.)

procedure TForm1.Table1BeforePost(DataSet: TDataSet); 
 begin 
   if Table1ID.Value <= 0 then 
   begin 
     // the data is invalid!!
     Showmessage('Error! Invalid value!'); 
     Abort
   end
   else 
     Table1.Post; 
 end; 

Generated 20:01:03 on Apr 1, 2020