Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SetWhereClause: Multiple Parameters

616023Feb 15 2008 — edited Feb 15 2008
I have an ADF Parameter Form that I implemented on a JSP page to allow users to enter search criteria. The criteria entered is entered into the where clause with the following code:

public void searchInventory(Number OwnerName, Number UnitNo, Number Loc, Number Citem, String SNO, Number Project)
{
ViewObject vo = getInvView();
String sql = "OWNERNAME LIKE '%" + OwnerName + "%'" + " OR UNITNO LIKE '%" + UnitNo + "%'" + " OR LOC LIKE '%" + Loc + "%'" + " OR CITEM LIKE '%" + Citem + "%'" + " OR SNO LIKE '%" + SNO + "%'" + " OR PROJECT LIKE '%" + Project + "%'";
vo.setWhereClause(sql);
vo.executeQuery();

}

This isn't working because I'm not sure the correct fields are being passed in correctly. Is there a way to bind the fields to a variable that i can pass into this method? Also, does anyone have any suggestions on how to prevent sql injection through these fields?

Thanks,
[tim]
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 14 2008
Added on Feb 15 2008
1 comment
1,742 views