L
Luc Kumps
Let's say I have three database tables, each one having 2 columns:
DOCUMENTS contains columns "DOC_ID" (autonumbered) and "Name" (string)
DOCU_KEY contains columns "DOC_ID" and "KEY_ID" (both indexed)
KEYWORDS contains KEY_ID (autonumbered) and "Keyword" (string)
It is set up this way to be able to assign multiple keywords to each
document, and to keep the database normalised.
Now I would like to display two DataGrids, one displaying a list of
documents, a second one displaying the keywords that have been assigned to
those documents. I would also like to be able to insert (using the '*' row)
documents in the first DataGrid, and to insert keywords in the second
DataGrid.
When a keyword is used for the very first time, a new record should be added
to the KEYWORDS table. The next time, a record will be added to the DOCU_KEY
table, the KEYWORDS table remaining untouched.
While I could do this very easily by having only two tables (Documents and
Keywords) by using a DataRelation, and using that relation as a source for
the second DataGrid (by specifying DataMember="Documents.KeywordRel"), I
can't figure out how to do it with three tables. I guess there's a
straightforward solution, since even the most simple normalised database
contains this kind of setup over and over...
Or should I keep writing lots of application code?
Any suggestions?
Is there a good book explaining this kind of stuff?
TIA,
Luc K
DOCUMENTS contains columns "DOC_ID" (autonumbered) and "Name" (string)
DOCU_KEY contains columns "DOC_ID" and "KEY_ID" (both indexed)
KEYWORDS contains KEY_ID (autonumbered) and "Keyword" (string)
It is set up this way to be able to assign multiple keywords to each
document, and to keep the database normalised.
Now I would like to display two DataGrids, one displaying a list of
documents, a second one displaying the keywords that have been assigned to
those documents. I would also like to be able to insert (using the '*' row)
documents in the first DataGrid, and to insert keywords in the second
DataGrid.
When a keyword is used for the very first time, a new record should be added
to the KEYWORDS table. The next time, a record will be added to the DOCU_KEY
table, the KEYWORDS table remaining untouched.
While I could do this very easily by having only two tables (Documents and
Keywords) by using a DataRelation, and using that relation as a source for
the second DataGrid (by specifying DataMember="Documents.KeywordRel"), I
can't figure out how to do it with three tables. I guess there's a
straightforward solution, since even the most simple normalised database
contains this kind of setup over and over...
Or should I keep writing lots of application code?
Any suggestions?
Is there a good book explaining this kind of stuff?
TIA,
Luc K