源代码,一看就知道!开头部分,下面的本人下载下来看吧!publicpartialclassLoginForm:Form{publicstaticstringuacc;publicstaticstringupsw;publicstaticstringuname;publicstaticstringusex;publicstaticstringupart;publicstaticstringuright;publicLoginForm(){InitializeComponent();}privatevoidloginbtn_Click(objectsender,EventArgse){if(this.useracctxt.Text.Trim()==""&&this.pswtxt.Text==""){MessageBox.Show("请输入您的用户名和密码!","提示!");return;}try{stringsql;sql="select*fromtb_userwhereuacc='"+this.useracctxt.Text+"'andupsw='"+this.pswtxt.Text+"'";OleDbDataReaderdr=DBHelp.OleReader(sql);dr.Read();if(dr.HasRows){uacc=this.useracctxt.Text;upsw=this.pswtxt.Text;uname=dr["uname"].ToString();usex=dr["usex"].ToString();upart=dr["upart"].ToString();uright=dr["uright"].ToString();MainFormaf=newMainForm(this);this.Hide();this.useracctxt.Clear();this.pswtxt.Clear();af.Show();}else{MessageBox.Show("账号或密码错误!","提示!");this.useracctxt.Clear();this.pswtxt.Clear();this.useracctxt.Focus();}}catch(Exception){MessageBox.Show("数据库无法连接!","警告!");}}privatevoidcancelbtn_Click(objectsender,EventArgse){Application.Exit();}privatevoidLogi
2021/5/18 13:52:33
466KB
C#
1