Created
December 11, 2018 00:33
-
-
Save parzibyte/f03f338be4fde8258ee04d234e24ead5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func actualizar(c Contacto) error { | |
db, err := obtenerBaseDeDatos() | |
if err != nil { | |
return err | |
} | |
defer db.Close() | |
sentenciaPreparada, err := db.Prepare("UPDATE agenda SET nombre = ?, direccion = ?, correo_electronico = ? WHERE id = ?") | |
if err != nil { | |
return err | |
} | |
defer sentenciaPreparada.Close() | |
// Pasar argumentos en el mismo orden que la consulta | |
_, err = sentenciaPreparada.Exec(c.Nombre, c.Direccion, c.CorreoElectronico, c.Id) | |
return err // Ya sea nil o sea un error, lo manejaremos desde donde hacemos la llamada | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment