jQuery in Action, 2nd edition*
The moose likes JDBC and the fly likes How to give search query if we select one than one value from combo box Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to give search query if we select one than one value from combo box" Watch "How to give search query if we select one than one value from combo box" New topic
Author

How to give search query if we select one than one value from combo box

sv krishnaveni
Greenhorn

Joined: Mar 15, 2008
Posts: 3
In search....

i have one field like type: with type1,type2,type3 as options in combo box
i have selected 2 values type1,type2....then how to query the database to get result based on type1,type2 values..
[ July 10, 2008: Message edited by: Kittu ]
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2713
    
    5

Hi Kittu welcome to Javaranch,
Firstly your name does not follow the Javaranch Naming Policy please change ithere

then tell exactly what are you trying to do,what are you searching, I think you want to query a database using the user input, if yes then what is the problem.
[ July 10, 2008: Message edited by: Amit Ghorpade ]

SCJP, SCWCD.
|Asking Good Questions|
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60072
    
  65

"krishnaveni_sv", please check your private messages for an important administrative matter. Again.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60072
    
  65

Also, there is no such things as a "combo box" in HTML. Please read this for more information.
arunkumar subramanian
Ranch Hand

Joined: Jun 10, 2008
Posts: 32
By combo box, you mean <select> box?



Statement can be replaced by PreparedStatement, but not sure.

Hope this helps.
[ July 10, 2008: Message edited by: arunkumar subramanian ]
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3697
    
    5

Arunkumar, please note your code is not safe for SQL injections. In particular the input String "'); DELETE FROM Users; SELECT * FROM widgets WHERE ID IN ('1" might cause you some problems (or variations on it)
[ July 10, 2008: Message edited by: Scott Selikoff ]

My Blog: Down Home Country Coding with Scott Selikoff
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to give search query if we select one than one value from combo box
 
Similar Threads
How to handle more than two combobox
Grabbing char from strings
print database values with radio button
Accessing Variable within Variable
combo boxes and iterator