Bom dia pessoal
Preciso da ajuda de voces novamente, por favor.
tenho o seguinte metodo:
public ArrayList getListaTitulosPrestadoresDAO2(String CRM){
System.err.println(“RECEBI NO DAO: ****************”);
ArrayList listaCodigos = new ArrayList<>();
ClassePrestador classLista = new ClassePrestador();
try {
this.conectar();
File file = new File("sql\\buscarTitulos.sql");
FileInputStream fis = null;
String texto = "";
try {
fis = new FileInputStream(file);
int content;
while ((content = fis.read()) != -1) {
texto += (char) content;
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (fis != null) {
fis.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
System.err.println(texto);
this.executarSQL(texto);
while(this.getResultSet().next()){
classLista = new ClassePrestador();
classLista.setCD_PRESTADOR_PAGAMENTO(this.getResultSet().getString(1));
classLista.setDT_EMISSAO (this.getResultSet().getString(2));
classLista.setEVENTO (this.getResultSet().getString(3));
classLista.setDOCUMENTO (this.getResultSet().getString(4));
classLista.setCARTEIRINHA (this.getResultSet().getString(5));
classLista.setNM_USUARIO (this.getResultSet().getString(6));
classLista.setCODIGO (this.getResultSet().getString(7));
classLista.setPROCEDIMENTO (this.getResultSet().getString(8));
classLista.setVL_PAGO (this.getResultSet().getString(9));
classLista.setVL_GLOSADO (this.getResultSet().getString(10));
listaCodigos.add(classLista);
}
}catch(Exception e){
e.printStackTrace();
}finally{
this.fecharConexao();
}
return listaCodigos;
}
esse metodo lê uma consulta SQL, esta explodindo erro de index invalido na consulta pelo seguinte motivo. No arquivo eu coloquei uma linha para variável desta forma AND M.CD_PRESTADOR_PAGAMENTO = ‘"+CRM+"’, o metodo esta lendo certinho, mas não estou conseguindo parar o CRM no arquivo entao ele explode o erro de syntax
alguem tem alguma ideia de como posso passar o parametro para a varialvel dentro do arquivo?