Results 1 to 5 of 5

Thread: media library treeview

  1. #1

    Thread Starter
    Registered User
    Join Date
    Jul 2001
    Posts
    283

    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.

  2. #2

    Thread Starter
    Registered User
    Join Date
    Jul 2001
    Posts
    283
    ^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...

  3. #3
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    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:
    1. 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:
    1. myArtistRow = MyArtistDataTable.NewRow
    2) Fill in the column data...
    VB Code:
    1. myArtistRow.Item(0) = "someArtist"
    3) Add the row to the datatable...
    VB Code:
    1. 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.

  4. #4

    Thread Starter
    Registered User
    Join Date
    Jul 2001
    Posts
    283
    thanks. i will try some more with what you gave me...

  5. #5

    Thread Starter
    Registered User
    Join Date
    Jul 2001
    Posts
    283
    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
  •  



Click Here to Expand Forum to Full Width