Пример #1
0
 private void button_login_Click(object sender, EventArgs e)
 {//로그인 버튼
     try
     {
         if (textBox_id.Text.Trim() == "" || textBox_pwd.Text.Trim() == "")
         {
             MessageBox.Show("빈칸이 있습니다. 다시 입력해 주세요");
         }
         else
         {
             SqlLogin sqle  = new SqlLogin();
             int      count = sqle.Query_Select_DataSet("WHERE ID = '" + textBox_id.Text + "' and pwd ='" + textBox_pwd.Text + "'").Tables[0].Rows.Count;
             if (count == 1)
             {
                 string strId   = sqle.Query_Select_DataSet("WHERE ID = '" + textBox_id.Text + "' and pwd ='" + textBox_pwd.Text + "'").Tables[0].Rows[0]["ID"].ToString();
                 string strPwd  = sqle.Query_Select_DataSet("WHERE ID = '" + textBox_id.Text + "' and pwd ='" + textBox_pwd.Text + "'").Tables[0].Rows[0]["PWD"].ToString();
                 string strName = sqle.Query_Select_DataSet("WHERE ID = '" + textBox_id.Text + "' and pwd ='" + textBox_pwd.Text + "'").Tables[0].Rows[0]["NAME"].ToString();
                 if (strId == textBox_id.Text && strPwd == textBox_pwd.Text)
                 {
                     if (textBox_id.Text == "1" && textBox_pwd.Text == "1")
                     {
                         MessageBox.Show("운영자님 환영합니다.");
                         Form6 showForm6 = new Form6();
                         showForm6.Show();
                         this.Visible = false;
                     }
                     else
                     {
                         idValue = textBox_id.Text;
                         MessageBox.Show(strName + "님 환영합니다.");
                         // 추가
                         //  Form2 showForm2 = new Form2();
                         ProductListForm showForm2 = new ProductListForm();
                         showForm2.Show();
                         //sql.Id = textBox_id.Text;
                         this.Visible = false;
                     }
                 }
             }
             else
             {
                 MessageBox.Show("로그인 실패");
             }
         }
     }catch (Exception error)
     {
         //MessageBox.Show("로그인 실패");
         MessageBox.Show("" + error);
     }
 }