| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 551 人关注过本帖
标题:新手求教
取消只看楼主 加入收藏
a22358751
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2012-11-19
结帖率:100%
收藏
已结贴  问题点数:10 回复次数:1 
新手求教
一个系统,进入登入界面后跳出别的界面,那个登入界面怎么自动关掉?
  private void Lobt_Login_Click(object sender, EventArgs e)
        {
            SqlConnection con = MysqlConnection();            
            con.Open();
            String str = "select Uname ,Upass,Utype  from S_user where  Uname=@Uname and Upass=@Upass and Utype=@Utype";
            SqlCommand sqlCommand1 = new SqlCommand(str,con);
                    
            if (Lotb_Uname.Text == "" || Lotb_Upass.Text == "" || Locb_Utype.Text == "")
            {
                MessageBox.Show("请将信息补充完整!");
            }
            else
            {
                try
                {            
                    sqlCommand1.Parameters.AddWithValue("@Uname", Lotb_Uname.Text);
                    sqlCommand1.Parameters.AddWithValue("@Upass", Lotb_Upass.Text);
                    sqlCommand1.Parameters.AddWithValue("@Utype", Locb_Utype.Text);
                    SqlDataReader sdr = sqlCommand1.ExecuteReader();
                    bool b = sdr.Read();
                    name = Lotb_Uname.Text;
                    if (b == false)
                    {
                        MessageBox.Show("输入错误!请重新输入!");
                    }
                    else
                    {
                        PersenInfo[] personInfo =
                        {
                            new StudentInfo (Lotb_Uname.Text, Lotb_Upass.Text),
                            new TeacherInfo(Lotb_Uname.Text, Lotb_Upass.Text),
                            new ManagerInfo(Lotb_Uname.Text, Lotb_Upass.Text),
                        
                        };
                        
                       if (Locb_Utype.Text == "管理员")
                        {
                            personInfo[2].Show();
                        }
                        else
                        {
                            if (Locb_Utype.Text == "学生")
                            {
                               // Student stu = new Student();
                               // stu.Show();
                                personInfo[0].Show();
              
                            }
                            else
                            {
                                
                                //Teacher tea = new Teacher();
                                //tea.Show();
                                personInfo[1].Show();
                            }
                        }
                    }
   
                    sdr.Close();
               
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
                finally
                {
                    sqlCommand1.Parameters.RemoveAt("@Uname");
                    sqlCommand1.Parameters.RemoveAt("@Upass");
                    sqlCommand1.Parameters.RemoveAt("@Utype");
                    con.Close();
                }
            }
            Lotb_Uname.Text = "";
            Lotb_Upass.Text = "";
            Locb_Utype.Text = "";            
        }   
在哪里加代码可以解决这个问题啊?
求高手指教。      
搜索更多相关主题的帖子: private 系统 void where 
2012-11-19 16:10
a22358751
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2012-11-19
收藏
得分:0 
加了后两个界面都关了。怎么回事?
2012-11-20 12:20
快速回复:新手求教
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017916 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved