mercredi 2 mars 2016

Execute SQLite statement with a parameter

I have this method in C, where I delete a row from a table. I want to pass a parameter which is the primary key and then delete that row.

Here is my method:

void eliminarAlumno(char *mat) {
    abrirBD();
    error = sqlite3_exec(conexion, "delete from alumnos WHERE matricula=<mat>", 0, 0, &msjError);
    comprobarError(error, msjError);
    cerrarBD();
}

Where <mat> is the parameter. How can I do this?

Thanks.

Aucun commentaire:

Enregistrer un commentaire