📄 show.aspx.cs
字号:
using System;using System.Collections;using System.ComponentModel;using System.Data;using System.Drawing;using System.Web;using System.Web.SessionState;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.HtmlControls;using System.Data.OleDb;namespace Lb_news{ /// <summary> /// show 的摘要说明。 /// </summary> public class show : System.Web.UI.Page { protected string Lb_title; protected Conn ds2=new Conn(); protected int i=0; protected System.Web.UI.WebControls.DataGrid ClassDataGrid; protected string Lb_Class; protected string title; protected string content; protected int aid; protected int cid; protected string Lb_ClassId; protected string writer; protected DateTime de; protected int hints; protected OleDbDataReader rd; protected OleDbDataReader rd2; protected DataSet ds; protected UrlFormat urlFormat=new UrlFormat(); private void Page_Load(object sender, System.EventArgs e) { // 在此处放置用户代码以初始化页面 if(!Page.IsPostBack) { def(); news(); } } private void def() { ds2.DBopen(); rd=ds2.ExecuteOleDbDataReader("select * from Lb_Setup"); if (rd.HasRows) { rd.Read(); Lb_title=(string)rd["S_Title"]; } else { Response.Write ("暂时没有记录"); } ds2.DBclose(); } private void Lb_Site(int cid) { int nid=Int32.Parse(Request["nid"]); rd2=ds2.ExecuteOleDbDataReader("select * from Lb_Class where C_Id="+cid+""); if (rd2.HasRows) { rd2.Read(); Lb_Class=(string)rd2["C_Name"]; Lb_ClassId=urlFormat.ClassUrl((int)rd2["C_Id"]); rd2.Close(); } else { Response.Write ("暂时没有记录"); } } private void news() { int nid=Int32.Parse(Request["nid"]); ds2.DBopen(); try { rd=ds2.ExecuteOleDbDataReader("select * from Lb_News where n_id="+nid+""); if (rd.HasRows) { rd.Read(); aid=(int)rd.GetValue(0); title=(string)rd["n_title"]; content=(string)rd["n_content"]; writer=(string)rd["n_author"]; hints=(int)rd.GetValue(2); de=rd.GetDateTime(6); cid=(int)rd["n_cid"]; rd.Close(); Lb_Site(cid); } else { Response.Write ("暂时没有记录"); } ds2.ExecuteSql("update Lb_News set n_hit=n_hit+1 where n_id="+nid+""); } catch(System.Data.OleDb.OleDbException ex) { Response.Write (ex.ToString()); } finally { ds2.DBclose(); } } #region Web 窗体设计器生成的代码 override protected void OnInit(EventArgs e) { // // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。 // InitializeComponent(); base.OnInit(e); } /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { this.Load += new System.EventHandler(this.Page_Load); } #endregion }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -