Gulafsan Shaheen

4 Mar 2022

The table does not exist error while inserting into database?

Python

I am making a login system by which  a user can generate username and password which will be inserted into a database, in the "CreateAccount" table. However when I run the program and try to create a username and password, the program says that the table "CreateAccount" does not exist. How do I fix this?

create = input("Would you like to create an account or re-enter Username?\nEnter 1 to re-enter, Enter 2 to create ")
 if create == "1":
 set_up()
 if create == "2":
 New_Username = input("Enter a username: ")
 New_Password = input("Enter a password: ")
 
 conn = sqlite3.connect('Database = NEA_quiz_database.db;'
 'Trusted_Connection = yes;')

 cursor = conn.cursor()

 cursor.execute("""
 INSERT INTO CreateAccount (UserID, Password)
 VALUES(New_Username, New_Password)
 """)
 conn.commit()

Comments

Shilpa

5 Mar 2022

github

It seems like your database connection is not alive, double-check your database server is up and running, it should work with your code.

© 2024 Copyrights reserved for web-brackets.com