在C#中连接了数据库怎么实现普通用户和管理员登录界面不同
今天做图书管理系统,想要实现管理用和用户登录界面不同,怎么都不会,我是一个程序白痴,在数据库中把管理员设置为1,普通用户设置为2,C#中有个下拉列表,怎么通过选择下拉列表,实现管理员和普通用户登录不同,求大神指教。
程序代码: string UserID = this.username.Text.Trim();
string UserPwd = this.password.Text.Trim();
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "initial Catalog=booksys;Data source=DELL4-330338\\SQLEXPRESS;integrated Security=SSPI";
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
= CommandType.Text;
"select * from userinfo where UName='"+UserID+"' and UPwd='"+UserPwd+"'";
SqlDataReader dr;
dr =cmd.ExecuteReader();
if
(dr.Read())
{
if (Form1.username.Equals(username) && user.Upwd.Equals(password))
{
if (comboBox1. == 1)
{
MessageBox.Show("欢迎管理员" + username + "登陆");
}
else
{
MessageBox.Show("欢迎用户" + username + "登陆");
}
Form2 fm = new Form2();
this.Hide();
fm.Show();
}
else{
this.lbError.Visible=true;
this.lbError.Text="你输入的用户名或者密码错误,请重新输入!";
}









