After a very long time I came back to Planner. I had forgotten everything.
Previously I had a separate DataSource and DataSet for each TDB..Source. Everything worked.
Now I have a single DataSource and DataSet. If I put an invalid value in a field, I get an exception. Just as proof that it works. But the write to the DB is not performed.
Please, what am I missing?
procedure TfrmPlannerRole.GetItemSource;
begin
if Assigned(dbplDay.ItemSource) then
begin
TDBItemSource(dbplDay.ItemSource).Active := False;
TDBItemSource(dbplDay.ItemSource).DataSource := nil;
end;
case TViews(FIdxSource) of
TViews.vwMultiDay: dbplDay.ItemSource := dbdysrMultiDay;
...
end;
TDBItemSource(dbplDay.ItemSource).DataSource := ibdsPlanner;
TDBItemSource(dbplDay.ItemSource).Active := True;
end;
procedure TfrmPlannerRole.dbpmwMonthItemToFields(Sender: TObject; Fields: TFields; Item: TPlannerItem);
begin
var NewItem := (Item.DBKey = '');
if NewItem then
begin
Item.DBKey := IntToStr(TSQLTexts.NewPrimaryKey);
Item.CaptionType := ctTime;
...
end;
if (not NewItem) and (Sender is TDBPlannerMonthView) then
begin
Fields.FieldByName('STARTTIME').AsDateTime := FPlanDates[StartTime];
Fields.FieldByName('ENDTIME').AsDateTime := FPlanDates[StartTime];
end;
Fields.FieldByName('IDPLANNERS').AsInteger := StrToInt(Item.DBKey);
...
end;