dcsimg
How can i pass query string in PreparedStatement for a query having LIKE
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Abhilash_Boinapally
Posted On:   Thursday, April 24, 2008 08:48 AM

I have a query


Select * from employee where emp_name like '%?%'

i am passing a query string

pst.setString(1,"abhi")


but its giving me a sql error non numeric character


how i need to pass quer string in these situation.


Thanks in advance

Re: How can i pass query string in PreparedStatement for a query having LIKE

Posted By:   Anonymous  
Posted On:   Tuesday, April 29, 2008 04:13 PM

You can write it as


Select * from employee where emp_name like ?


pst.setString(1,"%abhi%")

Re: How can i pass query string in PreparedStatement for a query having LIKE

Posted By:   Stephen_McConnell  
Posted On:   Thursday, April 24, 2008 02:18 PM

Here is an answer on another forum that might help:

SQL error using Like.


Hope this helps.


Stephen McConnell

About | Sitemap | Contact