my dog learned polymorphism*
The moose likes JDBC and the fly likes Servlets - dynamic query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
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
I agree. Here's the link:
subject: Servlets - dynamic query
Similar Threads
display a dynamic search page
memory usage with EntityBeans
How to make pagination?
Paging search results and multiple browser windows
How to convert blob data to image and display