I have the following JCheckBox:
and I need to collect the data of each of them to insert in the table with a "yes" if they select it, and "null" if they did not select it, someone has an idea how can I do that ????
Here I leave the code I use to save the rest that are jtextfield
JButton btnIngresar = new JButton("Ingresar");
btnIngresar.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
try {
Connection conexion = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;databaseName=Prueba2ºIF;user=sa;password=123456789;");
if (MisMetodos.buscarCi(ci.getText())) {
JOptionPane.showMessageDialog(null, "El empleado a ingresar ya existe");
} else {
String sentenciaSQL = "INSERT INTO [dbo].[Empleado]"+
"([Ci],[Nombre],[Apellido],[Apellido],[Direccion],[Email],[Celular],[Licencia],[Arma],[Fulltime],[MejorArteMarciial],[NumeroServicio])VALUES"
+ "("+"'"+ci.getText()+"','"+nombre.getText()+"','"+apellido.getText()+"',"+direccion.getText()+",'"+mail.getText()+"','"+ cel.getText()")";
Statement statement = conexion.createStatement();
statement.executeUpdate(sentenciaSQL);
}
conexion.close();
JOptionPane.showMessageDialog(null,"Libro Ingresado");
} catch (java.sql.SQLException e) {
System.err.println(e);
}
}
});