DB에 값 삽입 (아무 것도하지 않음)으로 갈 때 문제가 발생했습니다. 그 전에 내가 마지막 ID를 얻기 위해 테이블을 선택했는데 성공했습니다. 삽입 아무것도하지 않고,데이터베이스 삽입 mysql 문제가
IDBManager dbManager = getParentExtension().getParentZone().getDBManager();
Connection connection = null;
int idRoom = params.getInt("idRoom");
String betsmall = params.getUtfString("betsmall");
int Uid = params.getInt("recid");
try{
connection = dbManager.getConnection();
PreparedStatement stmt = connection.prepareStatement("SELECT id_game from detail_game ORDER BY id_game DESC LIMIT 1");
ResultSet res = stmt.executeQuery();
if (!res.first())
{
trace("bla bla");
}
int id = res.getInt("id_game");
trace (id);
// **till here there is no problem, i can get id from select query
PreparedStatement stmts = connection.prepareStatement("INSERT INTO detil_bet (id_user, id_room, id_bet, bettype) VALUES (?, ?, ?, ? ");
stmts.setInt(1, Uid);
stmts.setInt(2, idRoom);
stmts.setInt(3, id);
stmts.setString(4, betsmall);
stmts.executeUpdate();
}
}
가 여기에 문제의 : 다음은 내 코드입니다.
값 부분에')'이 없습니다. –
')'가 누락 된 경우 예외가 발생해야합니까?! – Jens
감사합니다.) a). –