I don't know what to make of this error. How do I pass through a SQL statement without it bringing up this error? I can only use quotations for SQL statements, so I can't change the data type.
I tried reformatting the INSERT statement to no avail.
class MD:
def __init__(self):
self.conn = sqlite3.connect('Ex.db')
self.cursor = self.conn.cursor()
self.cursor.execute('''CREATE TABLE IF NOT EXISTS Exa (
Ex1 INTEGER PRIMARY KEY,
Ex2 TEXT NOT NULL,
);''')
self.conn.commit()
def close(self):
self.conn.close()
self.cursor.close()
def execute(self, exone, extwo):
self.cursor.execute()
def fetchall(self):
self.cursor.fetchall()
def fetchone(self):
self.cursor.fetchone()
def commit(self):
self.conn.commit()
Ex1 = tk.StringVar
Ex2 = tk.StringVar
Entry = tk.Entry(textvariable=Ex1)
Entry1 = tk.Entry(textvariable=Ex2)
MD.execute('INSERT INTO INTO Exa(Ex1, Ex2) VALUES (?, ?)', exone=Ex1, extwo=Ex2)
The error is
Traceback (most recent call last):
File "C:/Users/S/Code/FurtherTest.py", line 42, in <module>
MD.execute('INSERT INTO INTO Exa(Ex1, Ex2) VALUES (?, ?)', exone=Ex1, extwo=Ex2)
File "C:/Users/S/Code/FurtherTest.py", line 25, in execute
self.cursor.execute()
AttributeError: 'str' object has no attribute 'cursor'