RicardoPereira
Programmer
i have a bean with a method that accept the client parameter. The problem is when i search a client with that character ' in the middle, like o'conner. How can i use this characters?
code:
public ArrayList getClients(String Client) throws SQLException {
ArrayList res=new ArrayList();
Connection con = getConnection();
PreparedStatement pstmt=
con.prepareStatement("exec Clients '" + Client + "'");
ResultSet rslt=pstmt.executeQuery();
while (rslt.next()) {
res.add(new TblClients (rslt.getString(1),rslt.getString(2),rslt.getString(3)) );
}
rslt.close();
pstmt.close();
con.close();
return res;
}
code:
public ArrayList getClients(String Client) throws SQLException {
ArrayList res=new ArrayList();
Connection con = getConnection();
PreparedStatement pstmt=
con.prepareStatement("exec Clients '" + Client + "'");
ResultSet rslt=pstmt.executeQuery();
while (rslt.next()) {
res.add(new TblClients (rslt.getString(1),rslt.getString(2),rslt.getString(3)) );
}
rslt.close();
pstmt.close();
con.close();
return res;
}