I am trying to store student data at school. I used to make several tables, for example, for passwords and teachers, which I later collect in one program.
I pretty much copied the create table function from one of them and changed the values for the student information. It works great with other programs, but I keep getting:
sqlite3.OperationalError: no such table: PupilPremiumTable
when I try to add a student to the table, it appears on the line:
cursor.execute("select MAX(RecordID) from PupilPremiumTable")
I look in the folder and there is a file called PupilPremiumTable.db , and the table has already been created before, so I don’t know why it does not work.
Here are some of my codes, if you need to feel free to tell me this anymore, since I said it worked before, so I don’t know why it doesn’t work or even what doesn’t work:
with sqlite3.connect("PupilPremiumTable.db") as db: cursor = db.cursor() cursor.execute("select MAX(RecordID) from PupilPremiumTable") Value = cursor.fetchone() Value = str('.'.join(str(x) for x in Value)) if Value == "None": Value = int(0) else: Value = int('.'.join(str(x) for x in Value)) if Value == 'None,': Value = 0 TeacherID = Value + 1 print("This RecordID is: ",RecordID)
python database sqlite3
Ben
source share