I am a beginner in Delphi and I need help with the following problem. I have to implement an editable DBGrid on my form. The DBGrid displays results from a query joining 3 tables. I managed to make the DBGrid editable but the edits have no effect on the database. I can insert, edit or delete rows in the DBGrid but these changes do not get saved to the database. I have the following settings:
Query2.DatabaseName=Test
Query2.SQL=SELECT cd.hourstart, cd.hourfinish, o.objname, cd."work", cd.worktime
FROM Card c JOIN CardDetail cd ON c.N=cd.card
JOIN objects o ON cd.project=o.N
WHERE c.worker=5 AND c.data=CONVERT(DATE, GETDATE())
Query2.UpdateObject=UpdateSQL2
Query2.CachedUpdates=True
Query2.RequestLive=True
UpdateSQL2.DeleteSQL=delete from CardDetail
where hourstart = :OLD_houerstart and
hourfinish = :OLD_houerfinish and
work = :OLD_work and
worktime = :OLD_worktime
UpdateSQL2.InsertSQL=...
UpdateSQL2.ModifySQL=...
DataSource2.DataSet=Query2
DBGrid2.DataSource=DataSource2
I am probably missing something but I don't know what. Any help would be appreciated!