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

📄 shownews.aspx.cs

📁 网络营销软件的源代码
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Data.SqlClient;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace WebApplication8.firstPage
{
	/// <summary>
	/// showNews 的摘要说明。
	/// </summary>
	public class showNews : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.Label title;
		protected System.Web.UI.WebControls.Label count;
		protected System.Web.UI.WebControls.TextBox body;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			if(Session["userName"]==null)
				Response.Redirect("../login.aspx");

			string sql = "",description="body";
			Connection connection = new Connection(Application["market"].ToString());

			count.Text = Application["count"].ToString();

			if(Request["type"] != null)
			{
				description = "description";
				sql = "select * from Advertise where id='"+Request["id"]+"'";
			}
			else
				sql = "select * from News where id='"+Request["id"]+"'";
			SqlDataReader reader = connection.execute(sql);

			if(reader.Read())
			{
				title.Text = reader["title"].ToString();
				
				body.Text = reader[description].ToString();
			}
			
			reader.Close();
		}

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