您好,我是编码的新手。我已经编写了一份用于注册表格的代码,并且代码运行无误。
def clicked():
try:
con = cx_Oracle.connect('app/reshmaa@10.23.129.216/XE')
cur = con.cursor()
emp_id=txt.get()
first_name=txt1.get()
last_name=txt2.get()
email_id=txt3.get()
"""if re.match("^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$",email_id,re.IGNORECASE):
email_id=txt3.get()"""
mobile_no=int(txt4.get())
last_update=str(date.today())
statement="insert into registration(emp_id, first_name, last_name, email_id, mobile_no, last_update, pass_word) values('%s', '%s', '%s', '%s','%s',to_date('%s','dd/mm/yyyy'),'%s')"%
(emp_id, first_name,last_name,email_id,mobile_no, last_update, pass_word)
cur.execute(statement)
con.commit()
max_char= 8
allchar= string.ascii_letters + string.digits + '!@#$%&*'
random.seed=(os.urandom(16))
pass_word= "".join(random.choice(allchar) for x in range(max_char))
messagebox.showinfo("Success","Your password is "+ pass_word)
except:
messagebox.showerror("Error","Check Your Details")
btn = Button(window, text="Register", bg="dodgerblue4", fg="silver", command=clicked)
btn.grid(column=5, row=7)
当我单击注册按钮时,它将在除外语句中显示错误消息框并停止。它在python shell(版本3.6.2)中未显示任何错误,并且输入的数据未插入我的oracle数据库表中。 有人可以帮助我解决我的代码中出现的错误吗?