vendredi 17 avril 2015

sqlite database not printing the contents of the database


createDataBase1 = sqlite3.connect('PythonDatabase_1.db')
queryCurs1 = createDataBase1.cursor()
def createtable():
queryCurs1.execute("""CREATE TABLE Scores
(id INTEGER PRIMARY KEY, Name TEXT, Class TEXT, Score INTERGER)""")

def addPupil1(Name, Class, Score):
queryCurs1.execute("""INSERT INTO Scores (Name, Class, Score)
VALUES(?,?,?)""",(Name, Class, Score,))

def main1():
createtable1()
addPupil1
(Name, Class, Score)
createDataBase1.commit()

queryCurs1.execute("SELECT * FROM Scores ORDER BY Score DESC")

title = ["id","Name", "Class", "Score"]
k = 0
for i in queryCurs1:
print "\n"
for j in i:
print title[k],
print j
if k < 3: k += 1
else: k = 0

queryCurs1.close()
if __name__ == '__main__':main()


This used to print out the results now it doesn't what is wrong? it used to display the results in a list format with the titles in front now it doesn't what is wrong


Aucun commentaire:

Enregistrer un commentaire