I think that I am missing something fundamental in working with SQL statements and the Query Delphi ADO component and / or setting up relationships between fields in (Access 2003) databases. I get error messages whenever I want to delete, update, etc. Something more complicated than SQL.Text = "SELECT something from aTable".
For example, I created a simple many-to-many relationship between the Outline and Reference tables. The join or join table is called Note:
Outline OutlineID (PK) etc. Reference RefID (PK) etc. Note NoteID (PK) OutlineID RefID NoteText
I enabled referential integrity in connections in Access, but did not check the boxes to cascade deletions or updates. Meanwhile, in Delphi my Query.SQL.Text
SELECT Note.NoteID, Outline.OutlineID, Ref.RefID, Note.NoteText, Ref.Citation, Outline.OutlineText FROM (Note LEFT JOIN Outline ON Outline.OutlineID=Note.OutlineID) LEFT JOIN Ref on Ref.RefID=Note.RefID;
First, I left the key references in the SELECT statement, creating the "insufficient column column information" error when I tried to delete a record from the summary table. I think I understand: you should select all the fields that db needs for any operations that will be proposed for execution. He cannot delete, update, etc., if he does not know why. (Is it correct?)
So how can I remove an entry from this query? In other words, I want (1) to display a grid showing NoteText, Citation and OutlineText, (2) to select a record from the grid, (3) to do something like clicking the "Delete" button in DBNavigator and (4) to delete a record from the notes table that has the same NoteID and NoteText as the selected record.
Al c
source share