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

📄 admin_classadd.aspx.cs

📁 如果遇到MD5加密文件(一般都是这个)
💻 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>	/// admin_classadd 的摘要说明。	/// </summary>	public class admin_classadd : System.Web.UI.Page	{		protected System.Web.UI.WebControls.TextBox LbNews_ClassName;		protected System.Web.UI.WebControls.RequiredFieldValidator required1;		protected System.Web.UI.WebControls.Button Submit;		protected Conn ds1=new Conn();		protected  OleDbDataReader rd;		protected  DataSet ds;		private void Page_Load(object sender, System.EventArgs e)		{			// 在此处放置用户代码以初始化页面			ds1.CheckCookies(3);		}		private void LbNews_AddClass()		{			try			{								string classname=LbNews_ClassName.Text.Trim();						string  strSql="select * from Lb_Class where C_Name='"+classname+"'";						ds1.DBopen();				rd=ds1.ExecuteOleDbDataReader(strSql);              				if (rd.Read()==true)				{					ds1.alert("已存在此分类,请填写其它","admin_classadd.aspx");									rd.Close();				}				else				{								rd.Close();							string SqlAddLink="insert into Lb_Class(C_Name)values('"+classname+"')";    					int result=ds1.ExecuteSql(SqlAddLink);					if(result>0)					{										ds1.alert("添加分类成功","admin_classadd.aspx");									}					else					{									ds1.alert("添加分类失败","admin_classadd.aspx");					}				}							}			catch(System.Data.OleDb.OleDbException ex)			{				Response.Write (ex.ToString());			}			finally			{							ds1.DBclose();				}				}		#region Web 窗体设计器生成的代码		override protected void OnInit(EventArgs e)		{			//			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。			//			InitializeComponent();			base.OnInit(e);		}				/// <summary>		/// 设计器支持所需的方法 - 不要使用代码编辑器修改		/// 此方法的内容。		/// </summary>		private void InitializeComponent()		{    			this.Submit.Click += new System.EventHandler(this.Submit_Click);			this.Load += new System.EventHandler(this.Page_Load);		}		#endregion		private void Submit_Click(object sender, System.EventArgs e)		{			if(Page.IsValid)			{				LbNews_AddClass();						}		}	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -