Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please give me suggestion

 
Deepa Balasubramanayam
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try the StringTokenizer and create multiple like statements separated by "or"
 
Raja Shekhar
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Raja Shekhar,
My program is working fine when I used StringTokenizer class.
Thanks
Deepa

------------------
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic