ASP.NET实现文章阅读次数功能
protected void Page_Load(object sender, EventArgs e) //这是文章阅读页面 { if (!IsPostBack) { string id = Request.QueryString["i"].ToString();//i是点击文章标题传的值 string strsql = "select * from articles where articleId=" + id; SqlCommand cmd = new SqlCommand(strsql, conn); conn.Open(); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { this.labTitle.Text = dr.GetString(2); this.labPubliser.Text = dr.GetString(3); this.labDatetime.Text = dr.GetString(5); this.labContent.Text = dr.GetString(4); } dr.Close(); Bind(); } }