What happens is that I'm making a library application and when I click on the Save button, I get this error:
Incompatible types boolean can not be converted to String
here is the code:
Save button:
Connection con=null;
try{
con=getConnection();
ps=con.prepareStatement("INSERT INTO clientes (rutClientes, Nombre, ApellidoPaterno, ApellidoMaterno, Direcciones, Telefonos, Correos, FechaNac) VALUES(?,?,?,?,?,?,?,?)");
if(ps.setString(1, txtRut.getText().equals(""))){ (AQUI ME SALE EL ERROR)
JOptionPane.showMessageDialog(null, "Rellene el campo de RUT");
}
if(txtNombre.getText().equals("")){
JOptionPane.showMessageDialog(null, "Rellene el campo de NOMBRE");
}
if(txtApellidoPaterno.getText().equals("")){
JOptionPane.showMessageDialog(null, "Rellene el campo de APELLIDO PATERNO");
}
if(txtApellidoMaterno.getText().equals("")){
JOptionPane.showMessageDialog(null, "Rellene el campo de APELLIDO MATERNO");
}
if(txtDireccion.getText().equals("")){
JOptionPane.showMessageDialog(null, "Rellene el campo DIRECCION");
}
if(txtTelefono.getText().equals("")){
JOptionPane.showMessageDialog(null, "Rellene el campo TELEFONO");
}
if(txtCorreo.getText().equals("")){
JOptionPane.showMessageDialog(null, "Rellene el campo CORREO");
}
if(txtFechaNac.getText().equals("")){
JOptionPane.showMessageDialog(null, "Rellene el campo de FECHA DE NACIMIENTO");
}
int res=ps.executeUpdate();
if(res>0){
JOptionPane.showMessageDialog(null, "Se ejecuto correctamente");
limpiarCajas();
}else{
JOptionPane.showMessageDialog(null, "Error al ejecutar la conexion");
limpiarCajas();
}
}catch(Exception e){
System.err.println(e);
}