user image

Gulafsan Shaheen
Published in : 2022-03-04

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 Date : 2022-03-05

Best answers

10

Best answers

10

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

Leave a comment

Join us

Join our community and get the chance to solve your code issues & share your opinion with us

Sign up Now

Related posts

Webscraping England Hockey Python BeautifulSoup
Publish date: 2022-03-04 | Comments: 0

Python

How to segregate data from a single cell in a scan pdf file.
Publish date: 2022-03-02 | Comments: 1

Python