login.cs

来自「毕业设计题目,学生成绩查询系统,包括管理员和普通用户两级管理」· CS 代码 · 共 44 行

CS
44
字号
using System;
using System.Data;
using System.Data.SqlClient;

namespace StudentScroeQuery.DAL
{
	/// <summary>
	/// login 的摘要说明。
	/// </summary>
	public class login:helper
	{
		public login()
		{
			//
			// TODO: 在此处添加构造函数逻辑
			//
		}
		public bool studentlogin(int num,string password)
		{
			this.comm.CommandText="select count(Student_name) from Student where Student_Id=@studentid and [Student_password]=@password";
			this.comm.Parameters.Add("@studentid",SqlDbType.Int).Value=num;
			this.comm.Parameters.Add("@password",SqlDbType.VarChar).Value=System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(password,"md5");
			int count=this.ExcuteCommandReturnNumber(this.comm);
			if(count!=0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		//修改登录密码
		public void updatepwd(int userid,string password)
		{
			comm.CommandText="update Student set Student_password=@password where Student_id=@userid";
			comm.Parameters.Add("@password",SqlDbType.VarChar).Value=password;
			comm.Parameters.Add("@userid",SqlDbType.Int).Value=userid;
			this.ExcuteCommandReturnVoid(comm);
		}
	
	}
}

⌨️ 快捷键说明

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