Ejemplo n.º 1
0
        private void btnCmtSelect_Click(object sender, EventArgs e)
        {
            String sql = "SELECT c.id, c.commenter, u.name, c.comment ";

            sql += " FROM comment AS c INNER JOIN users AS u ";
            sql += " ON c.commenter = u.userid ORDER BY id ASC ";
            lstComment.Items.Clear();
            DBconnection db = new DBconnection();

            lstComment = db.Select(sql, lstComment, 4);

            lstComment.HeaderStyle   = ColumnHeaderStyle.Nonclickable;
            lstComment.View          = View.Details;
            lstComment.FullRowSelect = true;
            lstComment.GridLines     = true;
        }
Ejemplo n.º 2
0
        public void btnSelect_Click(object sender, EventArgs e)
        {
            String sql = "Select userid, passwd, name, age, married, comment from users";

            DBconnection db = new DBconnection();

            lstUsers.Items.Clear();

            lstUsers = db.Select(sql, lstUsers, 6);
            if (lstUsers == null)
            {
                MessageBox.Show("리스트 에러발생");
            }
            lstUsers.HeaderStyle   = ColumnHeaderStyle.Nonclickable;
            lstUsers.View          = View.Details;
            lstUsers.FullRowSelect = true;
            lstUsers.GridLines     = true;
        }
Ejemplo n.º 3
0
        private void btnLgnOK_Click(object sender, EventArgs e)
        {
            // 아이디와 비밀번호가 올바른지 검증하는 과정은 차후 추가할 예정
            // 이 폼에서는 직접 sql을 입력하지 않고 DBconnection객체를 사용한다

            if (txtLgnID.Text.Equals("") || txtLgnPW.Text.Equals(""))                   //값이 입력되지 않은경우
            {
                MessageBox.Show("아이디 또는 비밀번호를 입력하십시오");
            }
            else
            {
                DBconnection confirm = new DBconnection();
                int          rtn     = confirm.pwdConfirm(txtLgnID.Text, txtLgnPW.Text);
                switch (rtn)
                {
                case 1:
                    MessageBox.Show("로그인 성공");
                    frmComment Form5 = new frmComment();
                    Form5.StartPosition = FormStartPosition.CenterScreen;
                    Form5.Show();
                    Close();
                    break;

                case 0:
                    MessageBox.Show("아이디또는 비밀번호가 일치하지 않습니다");
                    //필드를 초기화한다
                    txtLgnID.Text = "";
                    txtLgnPW.Text = "";
                    //탭을 아이디칸으로 이동시킨다
                    txtLgnID.Focus();
                    break;

                case -1:
                    MessageBox.Show("DB에서 문제가 발생했습니다");
                    break;

                default:
                    MessageBox.Show("알 수 없는 에러가 발생했습니다");
                    break;
                }
            }
        }
Ejemplo n.º 4
0
        private void btnAddCmtSave_Click(object sender, EventArgs e)
        {
            string sql = "INSERT INTO comment(commenter, comment) VALUES ( ";

            sql += " '" + txtAddCmtID.Text + "', ";
            sql += " '" + txtAddCmtComment.Text + "') ";
            DBconnection dbex = new DBconnection();
            int          rtn  = dbex.Execute(sql);

            if (rtn > 0)
            {               //입력이 완료되면 창을 닫는다
                MessageBox.Show("추가 되었습니다");
                CommonClass.form2_datachanged = true;
                Close();
            }
            else
            {
                MessageBox.Show("에러가 발생했습니다");
            }
        }
Ejemplo n.º 5
0
        private void btnAddCmtSave_Click(object sender, EventArgs e)
        {
            string sql = "UPDATE comment SET ";

            sql += " commenter = '" + txtChangeCmtID.Text + "', ";
            sql += " comment = '" + txtChangeCmtComment.Text + "' ";
            sql += " where id = '" + commentID + "' ";
            Console.WriteLine(sql);
            DBconnection updateCmt = new DBconnection();
            int          rtn       = updateCmt.Execute(sql);

            if (rtn > 0)
            {               //입력이 완료되면 창을 닫는다
                MessageBox.Show("변경 되었습니다");
                CommonClass.form2_datachanged = true;
                Close();
            }
            else
            {
                MessageBox.Show("에러가 발생했습니다");
            }
        }