private void btnUpdateSave_Click(object sender, EventArgs e) { char is_married = chkUpdateMarried.Checked ? 'y' : 'n'; string sql = ""; sql += " update users set "; sql += " userid = '" + txtUpdateID.Text + "', "; sql += " passwd = '" + txtUpdatePassword.Text + "', "; sql += " name = '" + txtUpdateName.Text + "', "; sql += " age = '" + txtUpdateAge.Text + "', "; sql += " married = '" + is_married + "', "; sql += " comment = '" + rtxtUpdateComment.Text + "' "; sql += " where userid = '" + initialID + "' "; //DB연결 DBconnection db = new DBconnection(); int rtn = db.Execute(sql); CommonClass.rtnValue(rtn); // 데이터 변경 플래그를 true로 만들고 //창을 닫는다 CommonClass.form1_datachanged = true; this.Close(); }
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("에러가 발생했습니다"); } }
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("에러가 발생했습니다"); } }