Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package practicaexa2.entidades;
- import DataAccessLayer.AccesoBDMySQL;
- import java.sql.DriverManager;
- import java.sql.ResultSet;
- import java.util.ArrayList;
- public class MultiCliente {
- private AccesoBDMySQL miAcceso = new AccesoBDMySQL("jdbc:mysql://localhost/db_ventas", "username", "password");
- public boolean Insertar(Cliente pCliente) {
- boolean result = true;
- try {
- String command = "INSERT INTO cliente (cedula, nombre, apellido1, apellido2) VALUES ('";
- command += pCliente.getCedula();
- command += "','";
- command += pCliente.getNombre();
- command += "','";
- command += pCliente.getApellido1();
- command += "','";
- command += pCliente.getApellido2();
- command += "')";
- miAcceso.ExecuteCommand(command);
- } catch (Exception err) {
- System.out.println(err.getMessage());
- result = false;
- }
- return result;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement