一般把用户权限存在数据库中
SqlConnection sqlconn=new SqlConnection("server=.;uid=sa;pwd=;database=member");
   SqlCommand sqlcmd=new SqlCommand("select operatorId,password,operatorType from operator",sqlconn);
   sqlcmd.Connection.Open();
   SqlDataReader sdr=sqlcmd.ExecuteReader();
   
   
   while(sdr.Read())
   {
    if((textBox1.Text).Trim()==sdr.GetValue(0).ToString() && (textBox2.Text).Trim()==sdr.GetValue(1).ToString())
    {
     label4.Text="";
     
     
     
     if(sdr.GetValue(2).ToString()=="operator")
     {
      Form1 f1=new Form1();
      oper=textBox1.Text;
      f1.czygl=false;
      f1.rzgl=false;
      f1.Show();
      this.Hide();
     }
     if(sdr.GetValue(2).ToString()=="manager")
     {
      Form1 f1=new Form1();
      oper=textBox1.Text;
      f1.czygl=true;
      f1.rzgl=false;
      f1.Show();
      this.Hide();
     }
     if(sdr.GetValue(2).ToString()=="system")
     {
      Form1 f1=new Form1();
      oper=textBox1.Text;
      f1.czygl=true;
      f1.rzgl=true;
      f1.Show();
      this.Hide();
     }
     
    }
    else
    {
     
     label4.Text="你输入的用户名或密码不正确,请重新输入!";
     
     
     textBox1.Focus();
     
     
    }
   }
偶也是初学的,这个是我以前做得按权限登陆的窗体,你看看对你有帮助没

我建了两个menuStrip ,分别设置了不同内容的菜单项目。把它们的Visible属性都设成 false了,当登陆时根据权限让他们Visible=true;
 目的是达到了,可是只有第一个菜单的显示位置是 顶层location(x,y)都是0
如果让第二个菜单显示却是下面的位置(x=98,52)。而且这个x,y是不能修改的 
										
