Advertisement
Guest User

Untitled

a guest
Jun 10th, 2017
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.01 KB | None | 0 0
  1. package practicaexa2.entidades;
  2.  
  3. import DataAccessLayer.AccesoBDMySQL;
  4. import java.sql.DriverManager;
  5. import java.sql.ResultSet;
  6. import java.util.ArrayList;
  7.  
  8. public class MultiCliente {
  9.  
  10.     private AccesoBDMySQL miAcceso = new AccesoBDMySQL("jdbc:mysql://localhost/db_ventas", "username", "password");
  11.  
  12.     public boolean Insertar(Cliente pCliente) {
  13.  
  14.         boolean result = true;
  15.         try {
  16.             String command = "INSERT INTO cliente (cedula, nombre, apellido1, apellido2) VALUES ('";
  17.             command += pCliente.getCedula();
  18.             command += "','";
  19.             command += pCliente.getNombre();
  20.             command += "','";
  21.             command += pCliente.getApellido1();
  22.             command += "','";
  23.             command += pCliente.getApellido2();
  24.             command += "')";
  25.             miAcceso.ExecuteCommand(command);
  26.         } catch (Exception err) {
  27.             System.out.println(err.getMessage());
  28.             result = false;
  29.         }
  30.  
  31.         return result;
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement