Pessoal bom dia!!!
Estou fazendo um programa onde estou na parte de pesquisa(estou usando banco access), essa pesquisa pode ser feita de três formas: cpf ou cnpj, protocolo, todos ou período.
Trata - se de um programa de registro de ligações, as pesquisas por inscrição, protocolo e todos estão sendo feitas perfeitamente porém a de período ñ consiguo obter exito, segue o código para ver se conseguem me ajudar <img src="https://cdn.jsdelivr.net/gh/twitter/twemoji@14/assets/72x72/s.pngmiley.png?v=9" title=":smiley:" class="emoji" alt=":smiley:"> gente desde ja agradeço
String sql = “”;
try {
if (rbTodos.isSelected()) {
sql = “select * from registro”;
}
if (rbInscr.isSelected()) {
sql = “select * from registro where inscricao = '” + tfInscr.getText() + “’”;
}
if (rbProtocolo.isSelected()) {
sql = “select * from registro where protocolo = '” + tfProtocolo.getText() + “’”;
}
if(rbData.isSelected()){
sql = “select * from registro where data between “+tfDataDE.getText()+” and data =”+tfDataATE.getText()+"";
}
apagaFormulário();
criajTable();
preencherTabela(sql);
Vou mandar também o método preencherTabela:
public void preencherTabela(String sql) {
modelo = (DefaultTableModel) tabela.getModel();
comandsSQL.conexBD.executaComandos(sql);
try {
comandsSQL.conexBD.resultSet.beforeFirst();
while (comandsSQL.conexBD.resultSet.next()) {
modelo.addRow(new Object[]{comandsSQL.conexBD.resultSet.getString(“inscricao”),
comandsSQL.conexBD.resultSet.getString(“nome”),
comandsSQL.conexBD.resultSet.getString(“contrato”),
comandsSQL.conexBD.resultSet.getString(“telres”),
comandsSQL.conexBD.resultSet.getString(“telcoml”),
comandsSQL.conexBD.resultSet.getString(“demanda”),
comandsSQL.conexBD.resultSet.getString(“subdemanda”),
comandsSQL.conexBD.resultSet.getString(“agencia”),
comandsSQL.conexBD.resultSet.getString(“conta”),
comandsSQL.conexBD.resultSet.getString(“email”),
comandsSQL.conexBD.resultSet.getString(“informacoes”),
comandsSQL.conexBD.resultSet.getString(“data”),
comandsSQL.conexBD.resultSet.getString(“protocolo”)});
}
}catch (SQLException e) {
JOptionPane.showMessageDialog(null, " Dados não encontrados");
}
}
vlw cara abrç até mais