
Como insertar un registro a una base de datos desde netbeans?
Publicado por Luis (2 intervenciones) el 15/06/2017 05:44:14
Intento agregar a una persona a una tabla en access pero me marca error.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
try {
String datos= "INSERT INTO Personal (ID_Personal,Nombre,Apellido,Sexo,CURP,Teléfono,F_Nac,Correo) "
+ "VALUES('" + txtID.getText()+ "',"
+ "'" + txtNombre.getText()+ "',"
+ "'" + txtApellido.getText()+ "',"
+ "'" + txtSexo.getText()+ "',"
+ "'" + txtCurp.getText()+ "',"
+ "'" + txtTel.getText()+ "',"
+ "#" + txtDia.getText()+ "/" + txtMes.getText()+ "/" + txtAnio.getText()+ "#,"
+"'" + txtCorreo.getText()+ "'"
+")";
sentencia.executeUpdate(datos);
MostrarTodos();
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, "Error");
}
Valora esta pregunta


0