I use jsp and sql and I want to query a table using a variable that I have already declared (entity)
here is my query:
..
String **entite**="informatique";
entite="informatique"
...
rs = st.executeQuery ("select * from User where User.id_e= &**entite** ");
entite is a variable
my question is: how to use a variable in a where clause
My prefered solution – Use a
PreparedStatementwith?andsetString(...)for parameters.See further details here:
http://download.oracle.com/javase/tutorial/jdbc/basics/prepared.html