-
Notifications
You must be signed in to change notification settings - Fork 1
/
Videos.aspx.cs
53 lines (50 loc) · 1.76 KB
/
Videos.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;
public partial class Videos : System.Web.UI.Page
{
string strcon = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{
String desc = "";
String t = "<h1>CLICK ON THE LINK TO VIEW THE VIDEO :";
SqlConnection connection = new SqlConnection(strcon);
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "select id,description FROM Video";
cmd.Connection = connection;
connection.Open();
SqlDataReader myReader = cmd.ExecuteReader();
while (myReader.HasRows)
{
while (myReader.Read())
{
desc = myReader["description"].ToString();
t += "<br/><a href='Videos.aspx?desc=" + desc+ "'>" + desc + "</a>";
}
myReader.NextResult();
}
t += "</h1>";
div1.InnerHtml = t;
connection.Close();
connection = new SqlConnection(strcon);
if (Request.QueryString["desc"]!= null)
{
String a = Request.QueryString["desc"].ToString();
cmd.CommandText = "SELECT id,url,description from [Video] where description='" + a + "'";
cmd.Connection = connection;
connection.Open();
myReader = cmd.ExecuteReader();
myReader.Read();
String t0 = myReader["url"].ToString();
YouTube1.VideoUrl = t0;
connection.Close();
}
}
}