我正在编写一个Asp.net代码,用于在从数据库中获取视频后在网站上播放视频.代码给出错误";预期"我试图找到我错过的地方,但我不能.请帮我解决它.在第8行给出错误,即string text = "<embed src="" + Str + "" height="300" width="500" />"; 这里是代码
protected void Page_Load(object sender, EventArgs e)
{
string play = Request.QueryString["id"];
string strSQL = "select * from videos where videosong_loc='" + play + "'";
SqlConnection sconn = new SqlConnection(@"Data Source=Khawaja\\SQLEXPRESS;Initial Catalog=TaskDB;Integrated Security=True;");
SqlCommand scomm = new SqlCommand(strSQL, sconn);
sconn.Open();
SqlDataReader sreader = scomm.ExecuteReader();
if (sreader.Read())
{
string Str = "videos\\" + sreader[1].ToString();
string text = "<embed src="" + Str + "" height="300" width="500" />";
//string text = "<embed height="300" />";
//Response.Write(text);
Label1.Text = text;
sreader.Close();
sconn.Close();
}
}
Run Code Online (Sandbox Code Playgroud)
错误在这里:
string text = "<embed src="" + Str + "" height="300" width="500" />";
Run Code Online (Sandbox Code Playgroud)
你没有逃脱双引号:
string text = "<embed src=\"" + Str + "\" height=\"300\" width=\"500\" />";
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
65 次 |
| 最近记录: |