0
String query = "INSERT INTO codigos(Nome,Codigo) VALUES( '"+nome+"','" +codigo+ "')";
rs = st.executeUpdate(query);
rs
is a resulset
,
st
is a statement
, an error appears to say that there is an incompatibility of types
needs the type java.sql.Resulset
and says he finds a int
.
I don’t understand why
According to the api documentation, the method
executeUpdate()
returns aint
– Ivan Silva
Read that.
– Victor Stafusa
As @Victorstafusa recommended if there are parameters in the query prefer Preparedstatement (including it makes the escape of special characters for you, thing that concatenation does not)
– Gustavo Fragoso