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 How to search record on (firstname+lastname) or (lastname+firstname)? please help me Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to search record on (firstname+lastname) or (lastname+firstname)? please help me " Watch "How to search record on (firstname+lastname) or (lastname+firstname)? please help me " New topic
Author

How to search record on (firstname+lastname) or (lastname+firstname)? please help me

Gautam Ry
Ranch Hand

Joined: Dec 30, 2008
Posts: 41
Hi
I need your help to resolve the following issue.please, help me.
I need to search employee on (firstname+lastname) or (lastname+firstname). SQL-2000 is DB.
the piece of code is as follows


On execution, I am getting "nested exception is: java.sql.SQLException: [IBM][SQLServer JDBC Driver]Invalid parameter binding(s). "

How to resolve? please, help me.

regards
Gautam


Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

What is the SQL behind qryforEmployeeSearch_fullname ?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Gautam Ry
Ranch Hand

Joined: Dec 30, 2008
Posts: 41
it is as below

private static final String qryforEmployeeSearch_fullname ="select e.emp_eid, rtrim(ltrim(e.emp_firstname)) +' '+rtrim(ltrim(emp_lastname))+' ['+e.emp_eid+']' as emp_name," +
" e.emp_tm_tid as teamname from tblEmployee e where " +
"(e.emp_lastname like ? and e.emp_firstname like ?)or (e.emp_firstname like ? and e.emp_lastname like ?) order by e.emp_firstname ";

regards
Gautam
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

So you have four bind parameters declared but you only bind two. You'll need to bind all of these.
Gautam Ry
Ranch Hand

Joined: Dec 30, 2008
Posts: 41
many many thanks to you. it's working as i changed
regards
gautam
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to search record on (firstname+lastname) or (lastname+firstname)? please help me