-1
I am creating a quiz. I managed to create the screen to create the questions, this recording in the database everything right. Only now I will do the "game" itself, so I would have to take a question that is stored in the bank and return to the screen, as I do this query in the bank? ResultSet
is giving error the code below.
String SQL = "Aqui montaria o SQL de Busca de Dificuldades no jogo
WHERE" ;
String Nivel=" ";
if(JrbFácil.isSelected()){
SQL += "DICICULDADE = FACIL"
}
if(JrbMédio.isSelected()){
SQL += "DICICULDADE = MEDIO"
}
if(JrbDificil.isSelected()){
SQL += "DICICULDADE = DIFICIL"
}
PreparedStatement stmt = this.connection.prepareStatement("select *from quiz where id = ?");
stmt.setInt(1, 1);
ResultSet rs = stmt.executeQuery();
What a mistake you’re making young?
– Edgar Muniz Berlinck
is not compiling
– Ivan Alves
Beauty, post the output with the build error...
– Edgar Muniz Berlinck
See if this is of any help: Search method involving Java and SQL Server
– Math
What is the use of the string
SQL
?– Gustavo Cinque
"Not compiling" is something very generic. Are you displaying an error? An Exception? Just looking at your code I noticed scores (á, í, ...), it is worth remembering that java is case sensitive. I recommend that you rephrase your question by posting the full code you are using and if possible inform the fields of the table that is searching for the information in the database. Help to be helped.
– Renan Gomes
You imported the
java.sql.ResultSet
?– ptkato