Tema: Acces y Java
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/05/2005, 12:41
birkin72
 
Fecha de Ingreso: abril-2005
Ubicación: chihuahua Mexico
Mensajes: 49
Antigüedad: 19 años, 10 meses
Puntos: 0
Acces y Java

Que tal no me funciona el siguiente codigo


class Act implements ActionListener{
public void actionPerformed(ActionEvent a){
// String nombre=((JButton)e.getSource()).getText();
// txt.setText(nombre);

try {

// Register JDBC/ODBC Driver in jdbc DriverManager
// On some platforms with some java VMs, newInstance() is necessary...
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newI nstance();

// Test with MS Access database (rjdemo ODBC data source)
String url = "jdbc:odbc:bd1";

java.sql.Connection c = DriverManager.getConnection(url);

java.sql.Statement st = c.createStatement();

String busqueda=txt.getText();
// String busqueda2=txt1.getText();
bus=Integer.parseInt(busqueda);

st.executeUpdate("UPDATE clientes SET clie=13,desc ='hola'");


}
catch(Exception e) {
e.printStackTrace();
}

Me sale este error :
C:\tarea>java Boton2
java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(Unk nown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)