⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 showaffiche.aspx.cs

📁 网上自动答疑系统(C#)
💻 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;

namespace dayi
{
	/// <summary>
	/// showAffiche 的摘要说明。
	/// </summary>
	public class showAffiche : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.Label lblContent;
		protected System.Web.UI.WebControls.Label lblSubject;
		protected System.Web.UI.WebControls.Label lblAdder;
		protected System.Web.UI.HtmlControls.HtmlForm Form1;
	
		dayi.controlDatabase cd=new controlDatabase();

		private void Page_Load(object sender, System.EventArgs e)
		{
			if(!this.IsPostBack)
			{
				try
				{
					//显示公告内容
					string id=Request.QueryString["id"].Trim();
					string sql="select * from [affiche] where [id]="+id;
					DataTable dt=cd.getDataTable(sql);
					if(dt.Rows.Count>0)
					{
						string subject=dt.Rows[0]["subject"].ToString().Trim();
						string addTime=dt.Rows[0]["addTime"].ToString().Trim();
						string boardID=dt.Rows[0]["boardID"].ToString().Trim();

						//得到所属栏目名
						string boardName="";
						DataTable bn=cd.getDataTable("select * from [board] where boardID="+boardID);
						if(bn.Rows.Count>0)
						{
							boardName=bn.Rows[0]["boardName"].ToString().Trim();
						}
						if(boardName=="")
							boardName=dt.Rows[0]["adder"].ToString();

						string content=dt.Rows[0]["content"].ToString();
					
						//显示
						this.lblSubject.Text=subject;
						this.lblAdder.Text="<b>"+boardName+"</b>&nbsp;"+addTime;
						this.lblContent.Text=content;
					}
				}
				catch(Exception ee)
				{
					Response.Write(ee.ToString());
					//Response.Redirect("err.aspx?err="+ee.Message);
				}
			}
		}

		#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 + -