Manning's Countdown to 2014
. Use discount code crdotd14 all month for 50% off every deal.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
building a dynamic Query String
Joined: Oct 18, 2003
Jul 09, 2004 00:43:00
building a dynamic Query
where can i get
Joined: Feb 18, 2004
Jul 09, 2004 20:53:00
Could you perhaps mean a
? For example:
String query = "SELECT * FROM sometable WHERE sometable.somefield = ?";
stmt = conn.prepareStatement(query);
The question mark represents a value that is set at runtime. You set the value with a call to a setter method on the Statement object:
// Could be setInt(), setDate(), setBoolean(), etc.
stmt.setString( 1, getValueForSQL() );
rs = stmt.executeQuery();
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
subject: building a dynamic Query String
Building Dynamic Query in JPA
Dynamically setting sort direction
Stored Procedure VS normal Query
Dynamic query creation
JPA Query using " where in" and setParameter
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013