登录分级验证模块详细代码

登录分级验证模块详细代码

ID:15158414

大小:57.00 KB

页数:5页

时间:2018-08-01

登录分级验证模块详细代码_第1页
登录分级验证模块详细代码_第2页
登录分级验证模块详细代码_第3页
登录分级验证模块详细代码_第4页
登录分级验证模块详细代码_第5页
资源描述:

《登录分级验证模块详细代码》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、登录分级验证模块详细代码连接数据库的类(自己编写的):conn.cs详细代码如下:usingSystem;usingSystem.Collections.Generic;usingSystem.Text;usingSystem.Data.SqlClient;namespaceWindowsApplication1{classconn{privatestringIP;privatestringDbName;privatestringDbUser;privatestringKey;publicconn(){//数据库服务器

2、名字:"3D470F5FC44F4EF",数据库名字:"testDB",登录数据库账号:"sa",登录数据库密码:"sa"IP="3D470F5FC44F4EF";DbName="testDB";DbUser="sa";Key="sa";}publicSqlConnectioncreatConn(){SqlConnectionthisConnection=newSqlConnection(@"Server="+IP+";userid="+DbUser+";initialcatalog="+DbName+";passwo

3、rd="+Key);thisConnection.Open();returnthisConnection;}}}登录主窗体:login.cs详细代码如下:usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;5usingSystem.Text;usingSystem.Windows.Forms;usingSystem.Data.SqlClient;namesp

4、aceWindowsApplication1{publicpartialclassForm1:Form{publicForm1(){InitializeComponent();}privatevoidbutton1_Click(objectsender,EventArgse){conncon=newconn();SqlConnectionsqlConnection=con.creatConn();SqlCommandcmd=newSqlCommand("SELECT*FROMLoginWHEREName='"+this

5、.textBox1.Text+"'andPwd='"+this.textBox2.Text+"'",sqlConnection);SqlDataReaderreader=cmd.ExecuteReader();stringdj="";stringdep="";stringpanduan="";if(reader.Read()){dj=(string)reader["dj"];dep=(string)reader["dep"];panduan=dep+dj;if(panduan=="系统管理系统管理员"){panduan

6、=dj;}if(panduan=="学工办学工领导"){panduan=dj;}MessageBox.Show("欢迎您,"+panduan+"","智能化管理系统提示");switch(panduan){case"系统管理员":5Form2frm=newForm2();frm.Show();this.Hide();break;case"学工领导":Form1frm1=newForm1();frm1.Show();this.Hide();break;case"生活权益部干事":Form1a=newForm1();a.S

7、how();this.Hide();break;case"生活权益部部长":Form2b=newForm2();b.Show();this.Hide();break;case"女生部部长":Form1c=newForm1();c.Show();this.Hide();break;case"女生部干事":Form1d=newForm1();d.Show();this.Hide();break;case"体育部部长":Form1bb=newForm1();bb.Show();this.Hide();break;case"体

8、育部干事":Form1f=newForm1();5f.Show();this.Hide();break;case"学习部部长":Form1g=newForm1();g.Show();this.Hide();break;case"学习部干事":Form1h=newForm1();h.Show();this.Hide();break;

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。