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

📄 checkuser.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;
using System.Data.SqlClient;
namespace car1
{
	/// <summary>
	/// checkuser 的摘要说明。
	/// </summary>
	public class checkuser : System.Web.UI.Page
	{
		private void Page_Load(object sender, System.EventArgs e)
		{
			string S_username=Request["username"].ToString();
			string S_password=Request["password"].ToString();
			if(S_username=="user"&S_password=="user")
			{
				
				Response.Redirect("main2.aspx");
				
			}
			string SqlConn=System.Configuration.ConfigurationSettings.AppSettings["ConnString"];
			SqlConnection Conn=new SqlConnection(SqlConn);
			Conn.Open();
			string SqlStr1="select username,userpwd from [user] where username='"+S_username+"' and userpwd='"+S_password+"' and userrule='超级用户'";
			SqlCommand Comm1=new SqlCommand(SqlStr1,Conn);
			SqlDataReader read1=Comm1.ExecuteReader();
			if(read1.Read())
			{
				Session["S_username"]=S_username;
				Session["S_userpwd"]=S_password;
				Response.Redirect("main.aspx");
				read1.Close();
				Conn.Close();
				
			}
			else
			{
				read1.Close();
				string SqlStr2="select username,userpwd from [user] where username='"+S_username+"' and userpwd='"+S_password+"' and userrule='普通用户'";
				SqlCommand Comm2=new SqlCommand(SqlStr2,Conn);
				SqlDataReader read2=Comm2.ExecuteReader();
				if(read2.Read())
				{
					Session["S_username"]=S_username;
					Session["S_userpwd"]=S_password;
					Response.Redirect("main1.aspx");
					read2.Close();
					Conn.Close();
					
				}
					
				else
				{
					read2.Close();
					string SqlStr3="select username,userpwd from [user] where username='"+S_username+"' and userpwd='"+S_password+"' and shenhe='0'";
					SqlCommand Comm3=new SqlCommand(SqlStr3,Conn);
					SqlDataReader read3=Comm3.ExecuteReader();
					if(read3.Read())
					{
						Response.Redirect("index.aspx");
						read3.Close();
						Conn.Close();
						

					}
					else
					{
						read3.Close();
						Conn.Close();
						Response.Redirect("index.aspx");
					}
					
					
					
				
				}
			
				}
			
			// 在此处放置用户代码以初始化页面
		}

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