浏览页面的源代码,title里面竟然跑一个<span
- HTML code
<head><title><span id="title">恋爱</span></title></head>
a.aspx
- HTML code
<asp:Label ID="title" runat="server" Text=""></asp:Label>
a.aspx.cs
- C# code
protected void Page_Load(object sender, EventArgs e) { string ST_sql = "select * from ST_news where ST_n_id=" + Request.QueryString["id"] + ""; SqlConnection cn = new SqlConnection(ConfigurationManager.AppSettings["conStr"]); //使用另外一个连接 cn.Open(); SqlCommand cmd = new SqlCommand(ST_sql, cn); SqlDataReader dr = cmd.ExecuteReader(); //DataList1.DataSource = dr; //DataList1.DataBind(); //SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { title.Text = dr["ST_n_title"].ToString(); //content.Text = dr["内容字段名"].ToString(); } }
------解决方案--------------------------------------------------------