I have this python code. I am using tk and pyodbc. when I have run this code, it inserts 0 value in user_id column in the database even I haven't enter anything in name_entry entry. how to handle same this problems.
in database: I have created tables and this is the code:
in database: I have created tables and this is the code:
CREATE TABLE test3
( entry_id int IDENTITY(1,1) PRIMARY KEY,
user_id int not null,
user_name VARCHAR (25) not NULL,
);and here are python code id_id=IntVar()
id_entry=tk.Entry(root, textvariable=id_id)
name_name=StringVar()
name_entry=tk.Entry(root,textvariable=name_name)
get_id=id_entry.get()
get_name=name_entry.get()
cursor.execute("""INSERT INTO test3 (user_id, user_name) VALUES (?,?)""", get_id, get_name)any help would be greatly appreciated
