Python:
I need help with finding what is the problem with the code. As
you can see when I try to register a new person to the database, it
gives an error code:
"Connection Failed no such table: Employee"
import sqlite3 conn=sqlite3.connect("05_Employee.db"
Name
A
Type
Size
Value
def registration(): with conn: registrationTest = False while not registrationTest: cur=conn.cursor() try: Employee_id = int(input("Please enter the employee ID: ")) print(Employee_id)
Email
str
1
george.cho@gmail.com
EmployeeID
str
1 Help
2256 Variable explorer
IPython console
Console 1/A
userEmail = input("Please enter the email: ") userEmail = userEmail.strip() while not userEmail:
In [3]: runfile('/Users/antonioavila/Documents/Bus-110A/ Practice.py', wdir='/Users/antonioavila/Documents/ Bus-11A')
Please enter the employee ID: 5575 5575
userEmail = userEmail.strip()
userPassword = input("please enter the password: ") userPassword= userPassword.strip() while not userPassword: userPassword = input("please enter the password: ") userPassword=userPa55word.strip()
Please enter the email: jane.doe@gmail.com
Please enter the password: jane
Please enter the last name: Doe Doe
l_name = input("Please enter the last name: ") l_name =l_name.lower().strip("").title() print(l_name)
Please enter the first name: Jane Jane connection failedno such table: Employee
f_name = input("please enter the first name: ") f_name =f_name.lower).strip"").title) print(f_name)
Please enter the employee ID: 5575 5575
Statement="INSERT INTO Employee VALUES{},'{},'{},'{},'{}"format (Employee_id, f_name, l_name,userEmail, userPassword) cur.execute(Statement) cur.execute("SELECT FROM Employee WHERE(EmployeeID ='{}')".format(Employee_id))
Please enter the email: jane.doe@gmail.com
Please enter the password: jane
Please enter the last name: Doe Doe
results = cur.fetchall() print(results) except Exception as e: print('connection failed'+ str(e)) conn.close()
Please enter the first name: Jane auer connection failedno such table: Employee