• # Bonjour

    Posté par . En réponse au message message erreur sqlite3:OperationalError. Évalué à 6. Dernière modification le 01 juin 2016 à 01:59.

    Pour commencer, pour poster ici, il faudrait que tu encadres ton code entre :

    ```python
    

    et
    ```

    parce que là c’est très chiant à lire...

    Tu imprimes ta requête ici :

    print(req)

    Quelle tronche elle a ? La visualisation de cette requête ne te permet pas de voir ce qui cloche ?

    sqlite3.OperationalError: no such column: nom d'un champ

    À priori tu essayes d’insérer une valeur dans un champ nommé : « nom d'un champ »... là comme ça je vois pas... ton code est pas super clair faut dire...

    Extrait de https://docs.python.org/3.5/library/sqlite3.html

    Usually your SQL operations will need to use values from Python variables. You shouldn’t assemble your query using Python’s string operations because doing so is insecure; it makes your program vulnerable to an SQL injection attack (see https://xkcd.com/327/ for humorous example of what can go wrong).

    Instead, use the DB-API’s parameter substitution. Put ? as a placeholder wherever you want to use a value, and then provide a tuple of values as the second argument to the cursor’s execute() method.

    ça rend le code plus clair en plus.