Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import mysql.connector
- mydb = mysql.connector.connect(
- host="localhost",
- user="root",
- password="",
- database="test"
- )
- mycursor = mydb.cursor()
- sql = "INSERT INTO empleados (dni, nombre, direccion, area, descripcion) VALUES (%s, %s, %s, %s, %s)"
- val = ("12345678", "Pedro Torres", "Av. Eclipse # 456", "rrhh", "Profesional en Recursos Humanos")
- mycursor.execute(sql, val)
- mydb.commit()
- print(mycursor.rowcount, "registro insertado !")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement