Hi
I have below code . I want Videos to be read from Sql Database
static async Task Main(string[] args)
{
List youtubevideoslinks = new List() { "youtube.com/watch?v=-wtIMTCHWuI",
"youtube.com/watch?v=-wtIMTCHWuI", "youtube.com/watch?v=-wtIMTCHWuI",
"youtube.com/watch?v=lalOy8Mbfdc", "youtube.com/watch?v=lalOy8Mbfdc",
"youtube.com/watch?v=lalOy8Mbfdc"};
foreach (var item in youtubevideoslinks)
{
RunVideo(item);
}
}
Thanks
Naimish MakwanaPosted Feb 25, 2023, 11:49 AM
Hello Ramco,
To get videos from database you can create a method as below:
Then you can use it in your code
Thanks
Naimish Makwana
Tuhin PaulPosted Feb 25, 2023, 3:21 PM
Hi Ramco,
You can modify the code as follows:
1. Create a SQL connection and query the database to retrieve the video links. Here's an example SQL query:
SELECT VideoLink FROM VideosTable
2. Execute the query and retrieve the video links using a SqlDataReader.
3. Replace the hardcoded youtubevideoslinks list with the retrieved video links.
Here's the modified code:
Replace the connectionString variable with the appropriate connection string for your SQL database. Also, ensure that the VideosTable and VideoLink column names match the table and column names in your database.
Ramco RamcoPosted Feb 25, 2023, 2:00 PM
Hi Naimish
Process has exited so the requested information is not available on below line though it runs. Secondly after first video it runs some other video. I want my videos should run automatically,
Thanks