Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sqlite3
- def loginTable():
- #Connecting or Creating a Database
- loginconnection = sqlite3.connect("Login_table.db")
- print("Successful connected / Created")
- #Creating a Table in the Database
- loginconnection.execute("CREATE TABLE LOGIN_TABLE (USERNAME TEXT,PASSWORD TEXT)")
- print("Successfully Created")
- #inserting Data collection into Database
- loginconnection.execute("INSERT INTO LOGIN_TABLE VALUES(?,?)",("admin","awosanya"))
- loginconnection.commit()
- print("Successful inserted")
- #Update info a database
- #Loginconnection.execute("UPDATE LOGIN_TABLE set PASSWORD = admin where USERNAME = Admin")
- #Loginconnection.execute("DELETE from LOGIN_TABLE where USERNAME=Admin")
- #selction of data from the database
- result = loginconnection.execute("SELECT * FROM LOGIN_TABLE")
- for data in result:
- print("Username : ", data[0])
- print("password : ", data[1])
- loginconnection.close()
- loginTable()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement