wood burning stoves
The moose likes JDBC and Relational Databases and the fly likes Servlets - dynamic query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Servlets - dynamic query" Watch "Servlets - dynamic query" New topic

Servlets - dynamic query

swati maken

Joined: Jan 12, 2001
Posts: 14
My problem is that if I want to create a dynamic query, in which I am successfull also, and I want to put this query in if -- else loop so how can it be possible.
Actually I have to do the search and show the result to the user which matches his or her search criteria and the result is to be fetched from the database. So I am creating the query dynamically and I have stored this query in a string now I want to put this query in if then else loop and fetch the records based on the query . But how this is possible I don't know.
Please help me out.
Waiting for ur reply.
Arunagiri, Shanmugham
Ranch Hand

Joined: Jan 23, 2001
Posts: 46
Try this out. Could be of some help..
int i=0;
rs=statement.executeQuery(<your query String here > );
out.println("Your criteria does not match ");
I hope u r expecting something like this..

Sun Certified Programmer for Java2 Platform
It is sorta covered in the JavaRanch Style Guide.
subject: Servlets - dynamic query
It's not a secret anymore!