File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Please give me suggestion 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 "Please give me suggestion" Watch "Please give me suggestion" New topic
Author

Please give me suggestion

Deepa Balasubramanayam
Ranch Hand

Joined: Mar 29, 2001
Posts: 39
I am working on a page that does job search.
I have created a textbox and search button. If i type JAVA in the textbox and press search all the jobs available in java is to displayed. The code i used in the resultset is:
ResultSet rs = statement.executeQuery("Select * "+
"From JobTable " + "Where skills like "+ "'%" +variable+"%'");
Variable stores the field that i pass in the textbox.
Now that if i type JAVA,HTML,JAVASCRIPT in the text box. All the jobs available has to be displayed. I wanted to know the code that i can use in my where clause.
------------------
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Try the StringTokenizer and create multiple like statements separated by "or"


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Raja Shekhar
Ranch Hand

Joined: Apr 02, 2001
Posts: 49
Hi !!
jsut try this...
StringTokenizer stn=new StringTokenizer(textbox,",")
while(stn.hasMoreTokens())
{
ResultSet rs = statement.executeQuery("Select * "+
"From JobTable " + "Where skills like "+ "'%"
+stn.nextToken()+"%'");

if (rs != null)
{
while(int i=1;i<=no.of column in the table;i++)
out.println(rst.getString(i));
}
}
Please let me know the o/p....
bye
Raj



Deepa Balasubramanayam
Ranch Hand

Joined: Mar 29, 2001
Posts: 39
Hi Raja Shekhar,
My program is working fine when I used StringTokenizer class.
Thanks
Deepa

------------------
 
 
subject: Please give me suggestion
 
Similar Threads
to get value from text box using javascript
Display of textbox
Need your guidance for building job search page.
Value passed from java to textbox is incomplete
Displaying null using rs.getFloat