Limite d linhas para salvar

0 respostas
java
R

alguém sabe me dizer pq só salvar 100 linha dessa jtable? quando tento salvar mais ele exclui dados e salva

int p = JOptionPane.showConfirmDialog(null, "Você deseja realmente salvar?", "Salvar", JOptionPane.YES_NO_OPTION);
        if (p == 0) {
try {
                Class.forName(driver);
                Connection con = DriverManager.getConnection(url, user, pass);
                for (int i = 0; i < CadresultadoTabela.getRowCount(); i++) {
String resultado_numerico = new String();
                    String resultado_texto = new String();
                    String observacao = new String();
                    String aprovado = new String();
try {
                        resultado_numerico = CadresultadoTabela.getValueAt(i, 30).toString();
                    } catch (Exception e) {
                        resultado_numerico = "";
                    }
try {
                        resultado_texto = CadresultadoTabela.getValueAt(i, 31).toString();
                    } catch (Exception e) {
                        resultado_texto = "";
                    }
try {
                        observacao = CadresultadoTabela.getValueAt(i, 32).toString();
                    } catch (Exception e) {
                        observacao = "";
                    }
try {
                        aprovado = CadresultadoTabela.getValueAt(i, 33).toString();
                    } catch (Exception e) {
                        aprovado = "";
                    }
if ((resultado_numerico != "" || resultado_texto != "") && aprovado != "") {
                        String sql = "INSERT INTO Resultado (ORDEM,LINHA,LINHA_TIPO,LINHA_SETOR,RCPERFIL,BPCS,"
                                + "DPERFIL,PROJETO,OEM,N_DESENHO,N_PLANO,OPERACAO,EQUIPAMENTO,DTESTE,"
                                + "RCOMPLEMENTO,RCTESTE,ESPEC_MIN,ESPEC_MAX,ESPEC_UNID,ESPEC_TEXTO,REFERENCIA,"
                                + "FREQUENCIA,FREQ_UNID,PRODUTO,ORIGEM,RTIPO,ESPECIFICACAO,FREQ_TEXTO,LAB,"
                                + "ENCONTRADO,ENCONT_TEXTO,OBS,APROVADO,DATA,HORA,REGISTRO) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
                        PreparedStatement pst = con.prepareStatement(sql);
//                System.out.println();
                        int Ordem = Integer.parseInt(CadresultadoTabela.getValueAt(i, 1).toString());//1
                        String Linha = (CadresultadoTabela.getValueAt(i, 2).toString());//2
                        String Linha_Tipo = (CadresultadoTabela.getValueAt(i, 3).toString());//3
                        String Setor = (CadresultadoTabela.getValueAt(i, 4).toString());//4
                        int Perfil = Integer.parseInt(CadresultadoTabela.getValueAt(i, 5).toString());//5
                        String Bpcs = (CadresultadoTabela.getValueAt(i, 6).toString());//6
                        String Desc_Perfil = (CadresultadoTabela.getValueAt(i, 7).toString());//7
                        String Projeto = (CadresultadoTabela.getValueAt(i, 8).toString());//8
                        String OEM = (CadresultadoTabela.getValueAt(i, 9).toString());//9
                        String Nº_Desenho = (CadresultadoTabela.getValueAt(i, 10).toString());//10
                        String Nº_Plano = (CadresultadoTabela.getValueAt(i, 11).toString());//11
                        String Operação = (CadresultadoTabela.getValueAt(i, 12).toString());//12
                        String Equipamento = (CadresultadoTabela.getValueAt(i, 13).toString());//13
                        String Desc_Teste = (CadresultadoTabela.getValueAt(i, 14).toString());//14
                        String Complemento = (CadresultadoTabela.getValueAt(i, 15).toString());//15
                        String Cod_Teste = (CadresultadoTabela.getValueAt(i, 16).toString());//16
                        float Espec_Min = Float.parseFloat(CadresultadoTabela.getValueAt(i, 17).toString());//17
                        float Espec_Max = Float.parseFloat(CadresultadoTabela.getValueAt(i, 18).toString());//18
                        String Espec_Unid = (CadresultadoTabela.getValueAt(i, 19).toString());//19
                        String Espec_Texto = (CadresultadoTabela.getValueAt(i, 20).toString());//20
                        String Referência = (CadresultadoTabela.getValueAt(i, 21).toString());//21
                        int Frequência = Integer.parseInt(CadresultadoTabela.getValueAt(i, 22).toString());//22
                        String Freq_Unid = (CadresultadoTabela.getValueAt(i, 23).toString());//23
                        String Produto = (CadresultadoTabela.getValueAt(i, 24).toString());//24
                        String Origem = (CadresultadoTabela.getValueAt(i, 25).toString());//25
                        String Tipo = (CadresultadoTabela.getValueAt(i, 26).toString());//26
                        String Especificação = (CadresultadoTabela.getValueAt(i, 27).toString());//27
                        String Freq_Texto = (CadresultadoTabela.getValueAt(i, 28).toString());//28
                        String Laboratorio = (CadresultadoTabela.getValueAt(i, 29).toString());//29
                        String Resultado_Numerico = resultado_numerico;//30
                        String Resultado_Texto = resultado_texto;//31
                        String Observação = observacao;//32
                        String Aprovado = aprovado;//33
pst.setInt(1, Ordem);//1
                        pst.setString(2, Linha);//2
                        pst.setString(3, Linha_Tipo);//3
                        pst.setString(4, Setor);//4
                        pst.setInt(5, Perfil);//5
                        pst.setString(6, Bpcs);//6
                        pst.setString(7, Desc_Perfil);//7
                        pst.setString(8, Projeto);//8
                        pst.setString(9, OEM);//9
                        pst.setString(10, Nº_Desenho);//10
                        pst.setString(11, Nº_Plano);//11
                        pst.setString(12, Operação);//12
                        pst.setString(13, Equipamento);//13
                        pst.setString(14, Desc_Teste);//14
                        pst.setString(15, Complemento);//15
                        pst.setString(16, Cod_Teste);//16
                        pst.setFloat(17, Espec_Min);//17
                        pst.setFloat(18, Espec_Max);//18
                        pst.setString(19, Espec_Unid);//19
                        pst.setString(20, Espec_Texto);//20
                        pst.setString(21, Referência);//21
                        pst.setInt(22, Frequência);//22
                        pst.setString(23, Freq_Unid);//23
                        pst.setString(24, Produto);//24
                        pst.setString(25, Origem);//25
                        pst.setString(26, Tipo);//26
                        pst.setString(27, Especificação);//27
                        pst.setString(28, Freq_Texto);//28
                        pst.setString(29, Laboratorio);//29
                        pst.setString(30, Resultado_Numerico);//30
                        pst.setString(31, Resultado_Texto);//31
                        pst.setString(32, Observação);//32
                        pst.setString(33, Aprovado);//33
pst.setString(34, txt_data.getText());
                        pst.setString(35, txt_hora.getText());
                        pst.setString(36, txt_registro.getText());
                        pst.executeUpdate();
                    }
}
            } catch (Exception e) {
                JOptionPane.showMessageDialog(null, e);
            }
        }
Criado 28 de junho de 2017
Respostas 0
Participantes 1