Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/05/2012, 14:10
Avatar de fahs82
fahs82
 
Fecha de Ingreso: abril-2012
Ubicación: guadalajara
Mensajes: 139
Antigüedad: 12 años
Puntos: 12
Pregunta Celda de jtable regresa al anterior valor al editar NETBEANS

Hola que tal , de nuevo pidiendo ayuda sobre setvalue en la clase de abstract table model , no se porque al momento de editar el contenido de una determinada celda del jtable el valor cantidad de mi tabla vuelve al anterior y no actualiza mi bd , posteo el codigo completo de como inicio la funcion al llamarla para cargar un form con la tabla

Código:
void Cantidadtallas(){
ConexionMySQL MySql = new ConexionMySQL();
Connection cn = MySql.Conectar();

String BuscarTallas = "select TALLA,CANTIDAD from TEMP_TALLAS_TRASP WHERE ID_ART = '" + IdArticulo + "'";


try{
Statement stTallas = cn.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE );
final ResultSet rsTallas = stTallas.executeQuery(BuscarTallas);

final ResultSetMetaData rsmd=rsTallas.getMetaData();
tblTallas.setModel(new javax.swing.table.AbstractTableModel () {
@Override
public String getColumnName( int c ) {
try {
if ( rsmd != null )
return rsmd.getColumnName(c + 1);
return "";
}
catch(SQLException e) { return ""; }
}
                @Override
                public int getRowCount() {try {
if ( rsTallas != null ) {
rsTallas.last(); // Nos situamos en la última fila
return rsTallas.getRow(); // Devolvemos el número de la fila
}
return 0;
}
catch(SQLException e) { return 0; }
                   
                }

                @Override
   public int getColumnCount() {try {
if ( rsmd != null )
return rsmd.getColumnCount();
return 0;
}
catch(SQLException e) { return 0; }
                    
                }

                @Override
                public boolean isCellEditable (int row, int column)
{

if (column == 1)
return true;
return false;
}
                

                @Override
                public Object getValueAt(int fila, int col) {try {
if ( rsTallas != null ) {
rsTallas.absolute( fila + 1 );
return rsTallas.getObject( col + 1 );
}
return "";
}
catch(SQLException e) { return null; }
                
                }
                @Override
public void setValueAt(Object aValue, int fila,int col){

try{ rsTallas.absolute(fila + 1);
        
          System.out.println("I got here... row: "+ fila + ", " + col + aValue);
          rsTallas.updateObject(col+1, (String)aValue);
          rsTallas.updateRow();
          fireTableCellUpdated(fila , col); 
     
    
			
}
catch(Exception ERo){}
}                
                
            });    


TallasArt.show();

}
catch(Exception BusTal){

}

}
agradesco la atencion de antemano