This example uses the BeforeInsert event to do data validation; if the StrToInt function raises an exception, the edit control's contents are set to a valid value so the assignment to the INTEGER field in the table will succeed.
procedure TForm1.MySQLTable1BeforeInsert(DataSet: TDataSet);
begin
try
// Make sure edit field can be converted to integer -
// - otherwise this will raise an exception.
StrToInt(Edit1.Text);
except
Edit1.Text := '0';
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
MySQLTable1.Insert;
MySQLTable1.FieldByName('QUANTITY').AsInteger := StrToInt(Edit1.Text);
MySQLTable1.Post;
end;