This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Please give me suggestion  RSS feed

 
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.
------------------
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try the StringTokenizer and create multiple like statements separated by "or"
 
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

------------------
 
It's a pleasure to see superheros taking such an interest in science. And this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!