Loading media files into WMP playlist through SQL

Hoongz

Active member
Joined
Nov 22, 2007
Messages
32
Programming Experience
1-3
I have to store mpeg files as varBinary into sql. Now i have to retrieve them and put them into the playlist for display. Is this the correct way of doing it?
VB.NET:
Dim connection As New SqlConnection(SqlConnection1.ConnectionString)
Dim command As New SqlCommand("Select files from Advertisement where sessionTime = @sessionTime", connection)
command.Parameters.AddWithValue(@sessionTime", "P1")

Dim dataAdapter As New SqlDataAdapter(command)
Dim result As New Data.DataSet

connection.Open()
dataAdapter.Fill(result, "Files")
connection.Close()

Dim fileNo As Integer = result.Tables("Files").Rows.Count
Dim count As Integer = 0
While count <= fileNo
    playlist = Me.AxMediaPlayer1.newMedia(result.Tables("Files").Rows(count).Item("Files"))
    AxMediaPlayer1.currentPlayList.appendItem(playList)
    count = count + 1
End While
 
Back
Top