Ver Mensaje Individual
  #12 (permalink)  
Antiguo 15/04/2009, 07:29
Avatar de drac94
drac94
 
Fecha de Ingreso: mayo-2008
Ubicación: México
Mensajes: 383
Antigüedad: 16 años
Puntos: 5
Respuesta: error Unknown column '' in 'where clause'

tiene razon elAntonie, deberias usar preparedstatement, es mas limpio, organizado y legible, es mas te lo voy a hacer para que veas que no es tan dificil

Código PHP:
public ArrayList<accountsDtoReadByNif (accountsDto accountsdtoString campothrows SQLException
{
    
Statement stmt;
    
ResultSet rs;
    
Connection con DriverManager.getConnection(url,login,password);

    
stmt con.createStatement();

    
String orden "SELECT * FROM ACCOUNTS WHERE NIF = ?";
    
PreparedStatement ps =  con.prepareStatement(orden); 
    
ps.setString(1accountsdto.getNif());

    
System.out.println("Se va a ejecutar en la BBDD la orden: "+orden);

    
rs=ps.executeQuery();

    
ArrayList <accountsDtoaccountsCollection = new ArrayList <accountsDto> ();

    while (
rs.next())
    {
        
accountsDto account = new accountsDto();

        
account.setAccountnumber(rs.getInt("ACCOUNTNUMBER" ));
        
account.setOffice(rs.getInt("OFFICE"));
        
account.setNif(rs.getString("NIF"));
        
account.setCreationdate(rs.getString("CREATIONDATE "));
        
account.setAccounttype(rs.getString("ACCOUNTTYPE") );
        
account.setAccountkey(rs.getInt("ACCOUNTKEY"));

        
System.out.println ("Datos de la cuenta: Account "+account.getAccountnumber()+", Office "+
        
account.getOffice()+", Nif of client "+account.getNif()+", Date of Creation "+
        
account.getCreationdate()+", Type of account "+account.getAccounttype()+
        
", key of account "+account.getAccountkey());

        
accountsCollection.add(account);
    }

    
con.close();
    return 
accountsCollection;

Saludos