C
Chris
Hi
Is there a way to use a PreparedStatement with a query such as
"SELECT * FROM table ORDER BY ?;"
where the first parameter is the name of the table field I'd like to
order the results to ?
I tried to following code :
The query seems to properly compile and execute, but the ResultSet is
not ordered as it should be
Moreover, I'd like to do something like :
Any Idea ?
Is there a way to use a PreparedStatement with a query such as
"SELECT * FROM table ORDER BY ?;"
where the first parameter is the name of the table field I'd like to
order the results to ?
I tried to following code :
PreparedStatement p = new PreparedStatement("SELECT * FROM table ORDER BY ?");
p.setString(1,"name");
The query seems to properly compile and execute, but the ResultSet is
not ordered as it should be
Moreover, I'd like to do something like :
But I think it is really impossible this time ...PreparedStatement p = new PreparedStatement("SELECT * FROM table ORDER BY ? ?");
p.setObject(1,"name");
p.setObject(2,"ASC");
Any Idea ?