-1

Hello,
i am designing a music site where i need to play the songs on click on the songname as we see in diffrent sites so can i get an help how can i get the song url using database.

Thanks,
Suhasini.

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by Ramesh S
0

Try this sample code

string connectionString = "Database=YourDatabaseName;Server=YourServername;User Id=YourUserId;Password=YourPassword";
        string songUrlName = string.Empty;
        using (SqlConnection connection = new SqlConnection(connectionString))
        {
            connection.Open();
            string queryString = "SELECT Song_URL FROM SONG WHERE Song_Id = 100";//Set correct song id
            SqlCommand command = new SqlCommand(queryString, connection);
            SqlDataReader reader = command.ExecuteReader();
            if(reader.Read())
            {
                songUrlName = reader["Song_URL"].ToString(); 
            }
            reader.Close();
        }

In the above, I assumed that you have stored song urls in SONG table. Also change connection string accordingly.


To play song in your web site, you can use <embed > HTML element.

Visit the following links:

http://www.tek-tips.com/faqs.cfm?fid=353
http://googlesystem.blogspot.com/2006/07/embed-mp3-files-into-your-website.html

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.