dimanche 22 novembre 2015

Connect to sqlite database - sqlite3.OperationalError: no such table

I tried to connect to my sqlite database test.db, but I get when I try to access the content the following error message: sqlite3.OperationalError: no such table: testtbl2, but I created this table already and I can see it with phpLiteAdmin. Thank you for helping me.

Here the Code I used:

   #!/usr/bin/python3


   import RPi.GPIO as GPIO
   import time
   import sqlite3 
   import sys

   GPIO.setwarnings(False)
   GPIO.setmode(GPIO.BOARD)
   GPIO.setup(26, GPIO.OUT)


   #Connection to Database
   conn = sqlite3.connect('/var/www/test.db')
   c = conn.cursor()
   c.execute('SELECT * FROM testtbl2')

   GPIO.cleanup()

Aucun commentaire:

Enregistrer un commentaire