Yea, I did at one point it was set to DataSource1. Ot wasn't set in what I posted.
I don't understand what this means...
Change your FormCreate method as follows:
procedure TForm1.FormCreate(Sender: TObject);
begin
DBConnection := TSQLConnector.Create(nil);
DBConnection.ConnectorType := 'SQLite3';
DBConnection.DataBaseName := 'Flights.DB';
{* -- Setup a transaction *}
DBTransaction := TSQLTransaction.Create(DBConnection);
DBTransaction.Database := DBConnection;
{* -- Setup a query *}
DBQuery := TSQLQuery.Create(DBConnection);
DBQuery.DataBase := DBConnection;
DBQuery.TransAction := DBTransaction;
{* We need to make some adjustments to avoid strings being displayed as
(memo) in a grid and we do that at the afteropen event *}
DBQuery.AfterOpen := @DBQueryAfterOpen;
{* -- Setup the datasource *}
DataSource := TDataSource.Create(Self);
DataSource.DataSet := DBQuery;
{* -- Connect the grid to the datasource *}
DBGrid1.DataSource := DataSource;
(* -- Connect the DBNavigator to the datasource *)
DBNavigator1.DataSource := DataSource; // <----------------- ADD
end;
Normally it is not needed to write an OnClick handler for DBNavigator because inserting, editing, or deleting of records is built into the navibator.
BTW, if you use only a DBGrid on the form, not any other DB-aware controls for editing, adding, deleting of records, then you don't need a navigator at all because these features can be done with the DBGrid as well.