title: How to prevent multiple entries of the same db? and sqlite3 now wont execute?
body: <pre><code>from tkinter import *
  import tkinter.messagebox as tm
  import sqlite3
  import array
  import pygame
  from pygame import *
  import random
  pygame.init()
  
  f=pygame.font.SysFont(None,60)
  
  class Login:
      def __init__(self):
          Label1 = Label(root,text = "Username")
          Label2 = Label(root,text = "Password")
          self.Entry1 = Entry(root)
          self.Entry2 = Entry(root,show = "*")
  
          Label1.grid(row=0)#default column is 0
          Label2.grid(row=1)
  
          self.Entry1.grid(row = 0,column = 1)
          self.Entry2.grid(row = 1,column = 1)
  
          root.minsize(width = 300,height = 80)
          lgbutton = Button(text = "Login",command = self.ButtonClicked)
          lgbutton.grid(columnspan = 2)
  
  
      def ButtonClicked(self):
              username = self.Entry1.get()
              password = self.Entry2.get()
              GetDatabase(username,password)#compares the username and password to the ones stored in the database
  
  def GetDatabase(username,password):
      conn=sqlite3.connect('TEST.db')
      c=conn.cursor
      c.execute("CREATE TABLE IF NOT EXISTS StudentLogin(surname TEXT, username TEXT, password INT);")
      c.execute("CREATE TABLE IF NOT EXISTS TeacherLogin(surname TEXT, username TEXT, password INT,class TEXT);")
      c.execute('''INSERT INTO StudentLogin (surname,username,password)
  VALUES
      ('Fred', 'Smith',123),
      ('John', 'Tucker',123),
      ('Michael', 'Jefford',123),
      ('Robert', 'Thomas',123);''')            
      c.execute('''INSERT INTO TeacherLogin(surname,username,password,class)
  VALUES('Tucker','HTucker',123,'12C/C1'),
  ('Cooper','ACooper',142,'12C/Ma1'),
  ('Smith','KSmith',1223,'12C/Ch1'),
  ('Elston','FElston',454,'12C/Ch1');''')
      StudentUsername=[]
      StudentPassword=[]
      TeacherUsername=[]
      TeacherPassword=[]
  
  
      c.execute("SELECT * FROM TeacherLogin;")
      for column in c:
          TeacherUsername.append(column[1])
          TeacherPassword.append(column[2])
  
      print(TeacherUsername)
      print(TeacherPassword)
  
      c.execute("SELECT * FROM StudentLogin;")
      for column in c:
          StudentUsername.append(column[1])
          StudentPassword.append(column[2])
      print(StudentUsername)
      print(StudentPassword)
  
  
      c.execute("DROP TABLE TeacherLogin;")
      c.execute("DROP TABLE StudentLogin;")
  
      if username in StudentUsername:
          correct=int(StudentUsername.index(username))
          if int(password) == StudentPassword[correct]:
          #if password in Password :
              tm.showinfo("Login info", "Welcome "+username)
              root.destroy()
              Simulation()
      elif username in TeacherUsername:
          correct=int(TeacherUsername.index(username))
          if int(password)==TeacherPassword[correct]:
              tm.showinfo("Login info", "Welcome "+username)
              root.destroy()
              TeacherLogin()
      else:
              tm.showerror("Login error", "Incorrect username or password")
  
      conn.commit()
      conn.close()
  
  def TeacherLogin()
      pass
  
  def StudentLogin():
      pass        
  
  root=Tk() #creating blank window
  root.resizable(width=False,height=False)
  root.title("Please login.")
  root.minsize(width=300,height=80)
  Login()
  root.mainloop()
  </code></pre>
  
  <p>At the moment I've written some code that allows the user to enter their username and password which will then compare their details to the ones in the database. It worked before, but now in comes up with the error of: </p>
  
  <pre><code>AttributeError: 'builtin_function_or_method' object has no attribute 'execute'
  </code></pre>
  
  <p>Why does it now not execute?</p>
  
  <p>Also, I'm quite new to sqlite3 and I'm wondering how to only insert the values into the db if they're not there as currently it has to drop the values in the table in order to stop them from being repeatedly added each time someone logs in incorrectly. As I don't want the db to be full of the same values. </p>