Geoge os índices de PreperedStatement começam com 1 ou seja o seu código ficaria assim:
public static final String SELECT = "select ? from ? ? ?";
 
no factory do select para uma table vai ter:

PreparedStatementps = this.database.getConnection().prepareStatement(Constantes.SELECT);

ps.setString(1, this.fieldName);

ps.setString(2, this.tableName);

ps.setString(3, this.where);

ps.setString(4, this.orderBy);

crs.populate(ps.executeQuery());

 
----- Original Message -----
Sent: Tuesday, February 04, 2003 3:59 PM
Subject: [java-list] PreparedStatement

Pessoal, estou tentando montar uma rotina de montagem do meu dml select, ex:
public static final String SELECT = "select ? from ? ? ?";
 
no factory do select para uma table vai ter:

PreparedStatementps = this.database.getConnection().prepareStatement(Constantes.SELECT);

ps.setString(0, this.fieldName);

ps.setString(1, this.tableName);

ps.setString(2, this.where);

ps.setString(3, this.orderBy);

crs.populate(ps.executeQuery());

Aqui ta dando erro Parameter index out of rang (0 > 5), como fazer com q essa idéia funcione

=====================================
George Queiroz 
Analista/Programador 
Alocado a www.informatec-sp.com
ICQ UIN#30519911
DDR +55 11 3868-6713

=====================================

Attachment: online?icq=30519911&img=3
Description: Binary data

Responder a