Ir ao conteúdo
  • Cadastre-se

Java Erro na hora de compilar


Posts recomendados

Olá galera , estou implantando um programa de uma cantina, o programa roda tranquilo tudo funciona mas aparece o seguinte erro : 

Can not issue empty query

 e não estou conseguindo achar este erro , alguém pode me ajudar ?


private void listagem() {
        String comando = "";
        String d;
        int l = 0;
        try {
            Conexao c = new Conexao();
            ResultSet rs;
            rs = c.consultar(comando);
            DefaultTableModel model = (DefaultTableModel) jTListagemVenda.getModel();
            int t = 1;
            while (rs.next()) {
                t++;
            }
            model.setNumRows(t);
            rs.first();
            do {
                jTListagemVenda.setValueAt(rs.getString("Codigo"), l, 0);
                jTListagemVenda.setValueAt(rs.getString("Nome"), l, 1);
                jTListagemVenda.setValueAt(rs.getString("PrecoVenda"), l, 2);
                l++;
            } while (rs.next());
        } catch (SQLException ex) {
            Logger.getLogger(Venda.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    private void listagem2() {
        String comando = "";
        String d, x;
        int l = 0, s = 0;
        try {
            Conexao c = new Conexao();
            ResultSet rs;
            int row = jTListagemVenda.getSelectedRow();
            Object k = jTListagemVenda.getValueAt(0, 0);
            comando = "select * from produto where codigo = +" + k;
            rs = c.consultar(comando);
            DefaultTableModel model = (DefaultTableModel) jTListagemVenda.getModel();
            int t = 1;
            while (rs.next()) {
                t++;
            }
            model.setNumRows(t);
            rs.first();
            jTListagemVenda.setValueAt(rs.getString("Codigo"), l, 0);
            jTListagemVenda.setValueAt(rs.getString("Nome"), l, 1);
            jTListagemVenda.setValueAt(rs.getString("PrecoVenda"), l, 2);
        } catch (SQLException ex) {
            Logger.getLogger(Venda.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    private void resultado() {
        String d;
        String comando = "";
        double qtd,valor;
        
        try {
            Conexao c = new Conexao();
            ResultSet rs;
            DefaultTableModel model = (DefaultTableModel) jTListagemVenda.getModel();
            int t = 1;
            qtd = Double.parseDouble(jTListagemVenda.getValueAt(0, 2).toString());
            valor = Double.parseDouble(jTListagemVenda.getValueAt(0, 3).toString());
            jTListagemVenda.setValueAt(qtd * valor, 0, 4);
            
            d = model.getValueAt(0, 4).toString();
            jTFTotalGeral.setText(d);
        } catch (SQLException ex) {
            Logger.getLogger(Venda.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

 

Link para o comentário
Compartilhar em outros sites

Crie uma conta ou entre para comentar

Você precisa ser um usuário para fazer um comentário

Criar uma conta

Crie uma nova conta em nossa comunidade. É fácil!

Crie uma nova conta

Entrar

Já tem uma conta? Faça o login.

Entrar agora

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...

 

GRÁTIS: ebook Redes Wi-Fi – 2ª Edição

EBOOK GRÁTIS!

CLIQUE AQUI E BAIXE AGORA MESMO!