|
-
Jan 30th, 2004, 11:06 AM
#1
Thread Starter
Registered User
media library treeview
i have a datset, which i store in xml. it has three tables, each with one column. "artists" "titles" "filepath"
i want to make artists unique, so if two files with the same artist are read from their id3 tag, then they both get pointed to the same item in the artist table, rather than having two artist items with the same value.
the point is that i can select an artist from the artists table and then i can easily see all the files with that artist.
how do i set up this kind of relation?
Last edited by marvinklein; Feb 1st, 2004 at 10:40 AM.
-
Feb 1st, 2004, 10:39 AM
#2
Thread Starter
Registered User
^bump
ok, i really need this help, so i'll explain a bit more.
i load ten mp3 files and decode their tags. then i save
artist, title and album in three different tables.
i want a treeview with the same structure as the medialibrary in windows media player. how do i have to set up my dataset so i can achieve that functionality?
Please give me some ideas...
-
Feb 1st, 2004, 10:58 AM
#3
I wonder how many charact
I take it you are using just an XML file for storing data, and not a database correct?
And you want a One (artist) to Many (titles).
You need two tables. One with Artists (ArtistUniqueID, ArtistName), one with Titles (TitleID, TitleName, ArtistID, FilePath). As you see, each table must have a column that acts as the unique identifier. You can use Guids for this, as you will be fine. So, for a new artist, you use MyArtistRow.Item("ArtistUniqueID") = Guid.NewGuid
When you read in a song and the name of its artist, you must go to your artists table to see if it already exists. Use a DataTable.Select statement.
VB Code:
MyArtists = MyArtistDataTable.Select("Select * From ArtistName Where ArtistName = " & artistname
If you get no rows back, then its a new artist:
1) Do a
VB Code:
myArtistRow = MyArtistDataTable.NewRow
2) Fill in the column data...
VB Code:
myArtistRow.Item(0) = "someArtist"
3) Add the row to the datatable...
VB Code:
MyArtistDataTable.Rows.Add(myArtistRow)
If you do get a row back, then grab that Artist's unique identifier, and store that identifier in the Titles table along with the song title.
-
Feb 1st, 2004, 11:35 AM
#4
Thread Starter
Registered User
thanks. i will try some more with what you gave me...
-
Feb 1st, 2004, 11:53 AM
#5
Thread Starter
Registered User
MyArtists = MyArtistDataTable.Select("Select * From TableName Where ColoumnName = " & artistname)
i get this error:
syntax: missing operand after TableName operator
any ideas what is wrong?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|