J
JP2006
I have a situation where I have 2 tables - NODES and TAGS. Nodes is the
main table and contains various columns one of which is tagID. Tags
contains a list of tag names and tagIDs. When a user adds an entry to
the Nodes table they can specify one or more tags for the entry. Then
when the form is posted if there were multiple tags in the post their
tagIDs are comma seperated before being inserted in the tagID column of
the Nodes table.
This all works fine and dandy.
The issue is that I then want to be able to display a list of Nodes
with their details including which tags are associated with them.
To display most of the Node info is easy and I am currently binding a
DataReader to a DataGrid to do this. However I need now to show the
tags for each Node so need to do some type of join in MySQL (I assume)
to get the tag names from their tagIDs. But this is further complicated
by the fact that each node may have comma seperated, mulitple tagIDs
associated with it and I need to put those into an array (or similar)
first in order to be able to treat them as integers before being able
to do much with them.
I'm sure I could write some custom code, ditching the datagrid, in
order to do this but am wondering whether there is a better way to do
it using other .NET objects - or whether the answer lies with SQL.
Any ideas?
main table and contains various columns one of which is tagID. Tags
contains a list of tag names and tagIDs. When a user adds an entry to
the Nodes table they can specify one or more tags for the entry. Then
when the form is posted if there were multiple tags in the post their
tagIDs are comma seperated before being inserted in the tagID column of
the Nodes table.
This all works fine and dandy.
The issue is that I then want to be able to display a list of Nodes
with their details including which tags are associated with them.
To display most of the Node info is easy and I am currently binding a
DataReader to a DataGrid to do this. However I need now to show the
tags for each Node so need to do some type of join in MySQL (I assume)
to get the tag names from their tagIDs. But this is further complicated
by the fact that each node may have comma seperated, mulitple tagIDs
associated with it and I need to put those into an array (or similar)
first in order to be able to treat them as integers before being able
to do much with them.
I'm sure I could write some custom code, ditching the datagrid, in
order to do this but am wondering whether there is a better way to do
it using other .NET objects - or whether the answer lies with SQL.
Any ideas?