problems with resulset and matrix

0

Hi, I have the following code, and the problem is that I can not pass the result of the results to the matrix, then use it in another class to fill a table and generate a pdf file, It always tells me in the out print that the value is NULL although the result shows the data I need. What I want is for the table data matrix to take the data from the results.

////boton Propietarios  
JButton btnPropietarios = new JButton("Propietarios");
btnPropietarios.addMouseListener(new MouseAdapter() {

public void mouseClicked(MouseEvent arg0) {
    while (modelo.getRowCount() > 0) modelo.removeRow(0);
    a=0;
    try {
        result = null;
        Connection conexion = DriverManager.getConnection(Menuppal1.ruta);
        PreparedStatement st = conexion.prepareStatement("select * from PROPI");
        result = st.executeQuery();
        //dese aqui
        int h=0;
        int g =0;
        Object Datosfila[] = new Object[4];
        String datostabla[][] = new String[4] [10000];
        while (result.next()){// Se rellena cada posición del array con una de las columnas de la tabla en base de datos.
            for (i=0; i<Datosfila.length; i++){
                Datosfila[i] = result.getObject(i+1);
                modelo.addRow(Datosfila);
                a++;
                txtsolventes.setText(Integer.toString(a));
                ///////
                datostabla[g][h] = (String) result.getObject(i+1);
                h++;
                g++;
                System.out.println(datostabla[g][h]);
                System.out.println("valor de g y h :" +g+ "====" + h);
                System.out.println("valor del result :" +result.getString(i+1));
                System.out.println("matriz["+g+"] ["+h+"]=" + datostabla[g] [h]);
                if (g==3){
                    g=0;
                }
            }
            ///////////////
        }
    }
}
    
asked by Marco Salazar 16.10.2018 в 16:10
source

0 answers