String sSql;
            SqlCommand sqlComm;
            SqlDataReader sqlReader;

            try
            {
                sSql = "SELECT PASSWORD FROM TB_USER WHERE USERID = @USERID ";
                sqlComm = new SqlCommand(sSql, DBConnection.conn);
                sqlComm.Parameters.Add(new SqlParameter("USERID", txtUserID.Text));
                sqlReader = sqlComm.ExecuteReader();
                if (sqlReader != null && sqlReader.HasRows)
                {
                    sqlReader.Read();
                    if (sqlReader.GetString(0) == txtPassword.Text)
                        this.Close();
                    else
                    {
                        txtPassword.Text = "";
                        MessageBox.Show("비밀번호가 틀립니다.");
                    }
                }
                else
                {
                    txtUserID.Text = "";
                    MessageBox.Show("존재하지 않는 아이디 입니다.");
                }
                sqlReader.Close();
            }
            catch (SqlException ex)
            {
                Program.angLog.WriteLog(String.Format("SQLException {0}", ex.Message));
            }
            catch (Exception ex)
            {
                Program.angLog.WriteLog(String.Format("Exception {0}", ex.Message));
            }

Posted by bluescor

블로그 이미지
bluescor

공지사항

Yesterday
Today
Total

달력

 « |  » 2025.4
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30

최근에 올라온 글

최근에 달린 댓글

글 보관함