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.
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.
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
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.