Windows Media Player - Play Song Help

fullyii

Member
Joined
Aug 19, 2005
Messages
22
Location
Chicago
Programming Experience
1-3
I currently load a static array to play several songs in a row.
On frmload I load the array with song path and then use the array to iterate through the songs.
I now have an Access database that holds the song information including file path. I also have a datagrid that displays all the records in the databse table.

What is the best way to extract the file path form the database and Play all the songs?

Is it possible to load a dynamic arraylist from a database and play all the songs in that list? if so how do I do this?

Example code:
'Load The songs into array
strSongs(1) = Application.StartupPath & "\Rufus Thomas - Walkin the Dog.mp3"
strSongs(2) = Application.StartupPath & "\Blues Legends - Slim Harpo - I'm A King Bee.mp3"
strSongs(3) = Application.StartupPath & "\Jaynettes - Sally Go Round the Roses ((Stereo)).mp3"
intSongPlaying = intSongPlaying + 1


Thank You,
Fullyii
 
The easiest way is to write all the song paths to a plain textfile line by line, name it "playlist.m3u", then run it from Process.Start("playlist.m3u"). You don't need an array for that.
 
I finally figured it out

Here is the code:

Private Sub LoadSongs()
'Use data reader to load Array list from database
strSongs = New ArrayList
Dim MySQL As String = "SELECT URL from tbl_Jukebox WHERE Active = 'Yes'"
Dim objDR As OleDb.OleDbDataReader
Dim Cmd As New OleDb.OleDbCommand(MySQL, conJukeBox)
conJukeBox.Open()
objDR = Cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
While objDR.Read()
strSongs.Add(objDR("URL"))
End While
ddl1.DataSource = strSongs
conJukeBox.Close()
End Sub
 
Back
Top