// boardId에 따라 데이터 삭제해주는 함수 - 삭제하려는 개수가 하나일 경우 public Boolean Delete(String boardId) { db = new CDatabase(); string sql = "DELETE Board WHERE board_id =" + boardId; Boolean result = db.ExecuteSQL(sql); db.Dispose(); return(result); }
// boardId에 따라 데이터 삭제해주는 함수 - 삭제하려는 개수가 여러개일 경우 public Boolean Delete(ArrayList boardNumList) { db = new CDatabase(); Boolean result = false; String sql = ""; foreach (object boardId in boardNumList) { string boardnum = (string)boardId; sql += "DELETE Board WHERE board_id =" + boardnum + "\n"; } result = db.ExecuteSQL(sql); db.Dispose(); return(result); }
// board 수정해주는 함수 public Boolean Update(String boardTitle, String boardWriter, String boardContent, String boardId) { CDatabase _db = new CDatabase(); string sql = ""; sql = "UPDATE Board SET board_title='" + boardTitle + "',board_date = CAST( GETDATE() AS DATE), board_content = '" + boardContent + "' WHERE board_id = " + boardId; Boolean result = _db.ExecuteSQL(sql); _db.Dispose(); return(result); }
// board 삽입해주는 함수 public Boolean Insert(String boardTitle, String boardWriter, String boardContent, String boardPw) { CDatabase db = new CDatabase(); string sql = ""; sql = "INSERT INTO Board(board_title,board_writer,board_date,board_content,board_pw)"; sql += "VALUES ('" + boardTitle + "','" + boardWriter + "',CAST( GETDATE() AS DATE),'" + boardContent + "','" + boardPw + "')"; Boolean result = db.ExecuteSQL(sql); db.Dispose(); return(result); }