在winform程序中实现按照不同的角色或用户展现不同的页面
SqlConnection cn = new SqlConnection();
cn.ConnectionString = "Data Source=192.168.16.71;Initial Catalog=myWork;User ID=sa;Password=sa";
try
{
cn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = cn;
string sql2 = "select * from dbo.工作微博 where 姓名='" + this.textBox1.Text + "' and 密码='" + this.textBox2.Text + "'";
cmd.CommandText = sql2;
cmd.CommandType = CommandType.Text;
SqlDataReader reader = cmd.ExecuteReader();
if (reader.Read()) //如果找到用户信息,说明登录成功
{
switch ("select 权限 from dbo.工作微博 where 姓名='" + this.textBox1.Text + "'")
{
case"0":
Form2 newForm = new Form2();
newForm.Show(); //弹出主窗体
break;
case "1":
Form3 f3 = new Form3();
f3.Show(); //弹出主窗体
break;
case "2":
Form1 f1 = new Form1();
f1.Show(); //弹出主窗体
break;
}
最新文章
- 64位win7硬盘安装64位ubuntu 13.04
- silverlight 富文本
- R %operator% 含义
- 百度,人人,新浪,腾讯等分享Js代码
- libvirtVirsh
- 测试class
- javascript常见面试题
- Windows XP Mode安装
- pod command
- B. Vova and Trophies 字符串预处理+思维+贪心
- .NetCore WebApi
- transitionEnd不起作用解决方法
- HNUOJ 13341
- python3中 getpass模块使用
- vue组件+axios访问本地json
- Azure Messaging-ServiceBus Messaging消息队列技术系列2-编程SDK入门
- vs2015 编译google v8
- $.extend与$.fn.extend()
- 在CentOS7上部署 Kubernetes集群
- 安装好XAMPP+安装好PhpStorm 然后搭建PHP开发环境