日期:2014-05-18 浏览次数:20520 次
<head> <title><span id="title">恋爱</span></title> </head>
<asp:Label ID="title" runat="server" Text=""></asp:Label>
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(); } }