📄 login.cs
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -