title: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'Smith' in 'where clause'
body: <p>hope you can help me. I get the error </p>
  
  <blockquote>
    <p>"com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown
    column 'Smith' in 'where clause'".</p>
  </blockquote>
  
  <p>I have a database called "aspirante" and it has a table (I already filled it) named "datos". Here I show you how I created the table:</p>
  
  <pre><code>CREATE TABLE `datos` (
    `id_asp` int(11) NOT NULL AUTO_INCREMENT,
    `ficha` mediumint(4) NOT NULL,
    `apellido1` varchar(30) NOT NULL,
    `apellido2` varchar(30) NOT NULL,
    `nombre` varchar(50) NOT NULL,
    `genero` char(1) NOT NULL,
    `telefono1` varchar(20) NOT NULL,
    `telefono2` varchar(20) NOT NULL,
    `carrera` varchar(50) NOT NULL,
    `promedio_sec` varchar(5) NOT NULL,
    PRIMARY KEY (`id_asp`)
  )
  </code></pre>
  
  <p>The method looks like this.</p>
  
  <pre><code>void BuscarAspiranteEditar(String id) {
      String sSQL = "";
      String ap1 = "", ap2 = "", nom = "", gen = "", tel1 = "", tel2 = "", car = "", prom = "";
  
      ConexionMySQL mysql = new ConexionMySQL();
      Connection cn = mysql.Conectar();
  
      sSQL = "SELECT id_asp, ficha, apellido1, apellido2, nombre, genero, telefono1, telefono2, promedio_sec FROM datos " +
              "WHERE id_asp = "+id;
  
      try {
          Statement st = cn.createStatement();
          ResultSet rs = st.executeQuery(sSQL);
  
          while (rs.next()) {
              ap1 = rs.getString("apellido1");
              ap2 = rs.getString("apellido2");
              nom = rs.getString("nombre");
              gen = rs.getString("genero");
              tel1 = rs.getString("telefono1");
              tel2 = rs.getString("telefono2");
              car = rs.getString("carrera");
              prom = rs.getString("promedio_sec");
              id_actualizar = id;
          }
  
          txtPrimerApellido.setText(ap1);
          txtSegundoApellido.setText(ap2);
          txtNombre.setText(nom);
          txtPrimerTelefono.setText(tel1);
          txtSegundoTelefono.setText(tel2);
          txtCarrera.setText(car);
          txtPromedio.setText(prom);
  
      }
      catch (SQLException ex) {
          JOptionPane.showMessageDialog(null, ex);
      }
  }
  </code></pre>
  
  <p>I am not into Java so I hope you can hel me guys, I'd appreciate it. Thanks in advance!</p>